Example #1
0
def test_605_with_reuse_tables_true_table_changed():
    "605 gpload with reuse_tables is true, but table's schema is changed, the staging table isn't reused."
    copy_data('external_file_08.txt', 'data_file.txt')
    write_config_file(mode='insert',
                      reuse_tables=True,
                      fast_match=False,
                      file='data_file.txt',
                      table='texttable',
                      error_limit=1002,
                      truncate=False)
Example #2
0
def test_604_with_reuse_tables_true_table_changed():
    "604 gpload with reuse_tables is true and specifying a staging_table, but table's schema is changed. so staging table dosen't match the destination table, load failed"
    psql_run(cmd="ALTER TABLE texttable ADD column n8 text",
             dbname='reuse_gptest')
    copy_data('external_file_08.txt', 'data_file.txt')
    write_config_file(mode='insert',
                      reuse_tables=True,
                      fast_match=False,
                      file='data_file.txt',
                      table='texttable',
                      staging_table='staging_test',
                      error_limit=1002,
                      truncate=False)
Example #3
0
def test_608_gpload_ext_staging_table():
    "608 gpload ignore staging_table if the reuse is false"
    file = mkpath('setup.sql')
    runfile(file)
    copy_data('external_file_13.csv', 'data_file.csv')
    write_config_file(reuse_tables=False,
                      format='csv',
                      file='data_file.csv',
                      table='csvtable',
                      delimiter="','",
                      log_errors=True,
                      error_limit=10,
                      staging_table='staging_table')
Example #4
0
def test_601_with_trucate_true():
    "601 gpload with truncate is true"
    file = mkpath('setup.sql')
    runfile(file)
    f = open(mkpath('query601.sql'), 'a')
    f.write("\\! psql -d reuse_gptest -c 'select count(*) from testtruncate;'")
    f.close()
    copy_data('external_file_04.txt', 'data_file.txt')
    write_config_file(mode='insert',
                      reuse_tables=False,
                      fast_match=False,
                      file='data_file.txt',
                      table='testtruncate',
                      error_limit=1002,
                      truncate=True)
Example #5
0
def test_602_with_reuse_tables_true():
    "602 gpload with reuse_tables is true"
    drop_tables()
    file = mkpath('setup.sql')
    runfile(file)
    f = open(mkpath('query602.sql'), 'a')
    f.write(
        "\\! psql -d reuse_gptest -c \"SELECT count(*) from pg_class WHERE relname like 'ext_gpload_reusable%' OR relname like 'staging_gpload_reusable%';\""
    )
    f.close()
    copy_data('external_file_04.txt', 'data_file.txt')
    write_config_file(mode='insert',
                      reuse_tables=True,
                      fast_match=False,
                      file='data_file.txt',
                      table='texttable',
                      error_limit=1002,
                      truncate=False)