diff --git a/target_snowflake/connector.py b/target_snowflake/connector.py index 88d5b2f..6961fe2 100644 --- a/target_snowflake/connector.py +++ b/target_snowflake/connector.py @@ -382,7 +382,7 @@ def _get_merge_from_stage_statement( # noqa: ANN202, PLR0913 dedup = f"QUALIFY ROW_NUMBER() OVER (PARTITION BY {dedup_cols} ORDER BY SEQ8() DESC) = 1" return ( text( - f"merge into {full_table_name} d using " # noqa: S608, ISC003 + f"merge into {full_table_name} d using " # noqa: ISC003 + f"(select {json_casting_selects} from '@~/target-snowflake/{sync_id}'" # noqa: S608 + f"(file_format => {file_format}) {dedup}) s " + f"on {join_expr} " @@ -407,7 +407,7 @@ def _get_copy_statement(self, full_table_name, schema, sync_id, file_format): # ) return ( text( - f"copy into {full_table_name} {col_alias_selects} from " # noqa: S608, ISC003 + f"copy into {full_table_name} {col_alias_selects} from " # noqa: ISC003 + f"(select {json_casting_selects} from " # noqa: S608 + f"'@~/target-snowflake/{sync_id}')" + f"file_format = (format_name='{file_format}')",