diff --git a/tests/test_core.py b/tests/test_core.py index 306316bb..02b83f50 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -36,7 +36,7 @@ def setup_test_table(table_name, sqlalchemy_url): """setup any state specific to the execution of the given module.""" - engine = sqlalchemy.create_engine(sqlalchemy_url) + engine = sqlalchemy.create_engine(sqlalchemy_url, future=True) fake = Faker() date1 = datetime.date(2022, 11, 1) @@ -49,7 +49,7 @@ def setup_test_table(table_name, sqlalchemy_url): Column("updated_at", DateTime(), nullable=False), Column("name", String()), ) - with engine.connect() as conn: + with engine.connect() as conn, conn.begin(): metadata_obj.create_all(conn) conn.execute(text(f"TRUNCATE TABLE {table_name}")) for _ in range(1000): @@ -60,7 +60,7 @@ def setup_test_table(table_name, sqlalchemy_url): def teardown_test_table(table_name, sqlalchemy_url): - engine = sqlalchemy.create_engine(sqlalchemy_url) + engine = sqlalchemy.create_engine(sqlalchemy_url, future=True) with engine.connect() as conn: conn.execute(text(f"DROP TABLE {table_name}")) @@ -137,7 +137,7 @@ def test_temporal_datatypes(): schema checks, and performs similar tests on times and timestamps. """ table_name = "test_temporal_datatypes" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table( @@ -197,7 +197,7 @@ def test_temporal_datatypes(): def test_jsonb_json(): """JSONB and JSON Objects weren't being selected, make sure they are now""" table_name = "test_jsonb_json" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table( @@ -248,7 +248,7 @@ def test_jsonb_json(): def test_decimal(): """Schema was wrong for Decimal objects. Check they are correctly selected.""" table_name = "test_decimal" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table( @@ -294,7 +294,7 @@ def test_decimal(): def test_filter_schemas(): """Only return tables from a given schema""" table_name = "test_filter_schemas" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table(table_name, metadata_obj, Column("id", BIGINT), schema="new_schema") @@ -333,7 +333,7 @@ def test_invalid_python_dates(): """ table_name = "test_invalid_python_dates" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table( diff --git a/tests/test_replication_key.py b/tests/test_replication_key.py index 30f3f769..da19d90d 100644 --- a/tests/test_replication_key.py +++ b/tests/test_replication_key.py @@ -1,4 +1,5 @@ """Tests standard tap features using the built-in SDK tests library.""" + import copy import json @@ -54,7 +55,7 @@ def test_null_replication_key_with_start_date(): greater than the start date should be synced. """ table_name = "test_null_replication_key_with_start_date" - engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(SAMPLE_CONFIG["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table( @@ -111,7 +112,7 @@ def test_null_replication_key_without_start_date(): modified_config = copy.deepcopy(SAMPLE_CONFIG) modified_config["start_date"] = None - engine = sqlalchemy.create_engine(modified_config["sqlalchemy_url"]) + engine = sqlalchemy.create_engine(modified_config["sqlalchemy_url"], future=True) metadata_obj = MetaData() table = Table(