def test_import_dicts_chunked(init_empty_test_repo, run_serve_mode): repo = init_empty_test_repo import_list(repo, 'characters', LIST_OF_DICTS, ['id'], 'create', batch_size=2) df = pandas_read_sql('select * from characters', repo.get_engine()) expected = pd.DataFrame(LIST_OF_DICTS) assert df.equals(expected)
def test_sql_server(create_test_table, run_serve_mode): """ This test ensures we can round-trip data to the database. :param create_test_table: :param run_serve_mode: :return: """ repo, test_table = create_test_table data = pandas_read_sql('SELECT * FROM {}'.format(test_table), repo.engine) assert list(data['id']) == [1, 2]
def test_import_lists(init_empty_test_repo, run_serve_mode): repo = init_empty_test_repo import_list(repo, 'characters', LIST_OF_DICTS, ['id'], 'create') df = pandas_read_sql('select * from characters', repo.engine) expected = pd.DataFrame(LIST_OF_DICTS) assert df.equals(expected)
def test_import_dict(init_empty_test_repo, run_serve_mode): repo = init_empty_test_repo import_dict(repo, 'characters', DICT_OF_LISTS, ['id'], 'create') df = pandas_read_sql('select * from characters', repo.get_engine()) expected = pd.DataFrame(DICT_OF_LISTS) assert df.equals(expected)