예제 #1
0
def test_import_base_data_ignore_partitions(src_dir, temp_db, temp_db_cursor):
    temp_db_cursor.execute('CREATE EXTENSION hstore')
    temp_db_cursor.execute('CREATE EXTENSION postgis')
    database_import.import_base_data('dbname=' + temp_db, src_dir / 'data',
                                     ignore_partitions=True)

    assert temp_db_cursor.scalar('SELECT count(*) FROM country_name') > 0
    assert temp_db_cursor.scalar('SELECT count(*) FROM country_name WHERE partition != 0') == 0
def test_import_base_data(src_dir, temp_db, temp_db_cursor):
    temp_db_cursor.execute('CREATE EXTENSION hstore')
    temp_db_cursor.execute('CREATE EXTENSION postgis')
    database_import.import_base_data('dbname=' + temp_db, src_dir / 'data')

    assert temp_db_cursor.scalar('SELECT count(*) FROM country_name') > 0