Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Use sqlalchemy.text in tests #305

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from faker import Faker
from singer_sdk.testing import get_tap_test_class, suites
from singer_sdk.testing.runners import TapTestRunner
from sqlalchemy import Column, DateTime, Integer, MetaData, Numeric, String, Table
from sqlalchemy import Column, DateTime, Integer, MetaData, Numeric, String, Table, text
from sqlalchemy.dialects.postgresql import BIGINT, DATE, JSON, JSONB, TIME, TIMESTAMP
from test_replication_key import TABLE_NAME, TapTestReplicationKey
from test_selected_columns_only import (
Expand Down Expand Up @@ -51,7 +51,7 @@ def setup_test_table(table_name, sqlalchemy_url):
)
with engine.connect() as conn:
metadata_obj.create_all(conn)
conn.execute(f"TRUNCATE TABLE {table_name}")
conn.execute(text(f"TRUNCATE TABLE {table_name}"))
for _ in range(1000):
insert = test_replication_key_table.insert().values(
updated_at=fake.date_between(date1, date2), name=fake.name()
Expand All @@ -62,7 +62,7 @@ def setup_test_table(table_name, sqlalchemy_url):
def teardown_test_table(table_name, sqlalchemy_url):
engine = sqlalchemy.create_engine(sqlalchemy_url)
with engine.connect() as conn:
conn.execute(f"DROP TABLE {table_name}")
conn.execute(text(f"DROP TABLE {table_name}"))


custom_test_replication_key = suites.TestSuite(
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_filter_schemas():
table = Table(table_name, metadata_obj, Column("id", BIGINT), schema="new_schema")

with engine.connect() as conn:
conn.execute("CREATE SCHEMA IF NOT EXISTS new_schema")
conn.execute(text("CREATE SCHEMA IF NOT EXISTS new_schema"))
if table.exists(conn):
table.drop(conn)
metadata_obj.create_all(conn)
Expand Down