From 1757044b740f50f82ec175831c0dd320d7187502 Mon Sep 17 00:00:00 2001 From: Steinthor Palsson Date: Wed, 2 Oct 2024 16:25:10 -0400 Subject: [PATCH] Fix sqlalchemy 2.0 --- dlt/destinations/impl/sqlalchemy/merge_job.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlt/destinations/impl/sqlalchemy/merge_job.py b/dlt/destinations/impl/sqlalchemy/merge_job.py index 8fae053bcd..5360939ba0 100644 --- a/dlt/destinations/impl/sqlalchemy/merge_job.py +++ b/dlt/destinations/impl/sqlalchemy/merge_job.py @@ -58,7 +58,7 @@ def gen_merge_sql( if len(table_chain) == 1 and not cls.requires_temp_table_for_delete(): delete_statement = root_table_obj.delete().where( sa.exists( - sa.select([sa.literal(1)]) + sa.select(sa.literal(1)) .where(key_clause) .select_from(staging_root_table_obj) ) @@ -81,9 +81,9 @@ def gen_merge_sql( # Insert data into the "temporary" table insert_statement = delete_temp_table.insert().from_select( [row_key_col], - sa.select([row_key_col]).where( + sa.select(row_key_col).where( sa.exists( - sa.select([sa.literal(1)]) + sa.select(sa.literal(1)) .where(key_clause) .select_from(staging_root_table_obj) ) @@ -370,7 +370,7 @@ def gen_scd2_sql( update_statement = ( root_table_obj.update() .values({to: sa.text(boundary_literal)}) - .where(root_table_obj.c[hash_].notin_(sa.select([staging_root_table_obj.c[hash_]]))) + .where(root_table_obj.c[hash_].notin_(sa.select(staging_root_table_obj.c[hash_]))) ) if active_record_timestamp is None: @@ -407,7 +407,7 @@ def gen_scd2_sql( *[c for c in staging_root_table_obj.columns if c.name not in [from_, to]], ).where( staging_root_table_obj.c[hash_].notin_( - sa.select([root_table_obj.c[hash_]]).where(root_is_active_clause) + sa.select(root_table_obj.c[hash_]).where(root_is_active_clause) ) ), )