diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be39498..97f1970 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: - id: check-github-workflows - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/target_snowflake/connector.py b/target_snowflake/connector.py index b5d612a..4b7df6e 100644 --- a/target_snowflake/connector.py +++ b/target_snowflake/connector.py @@ -406,7 +406,7 @@ def _get_merge_from_stage_statement( # noqa: ANN202 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: ISC003 + f"merge into {full_table_name} d using " # noqa: ISC003, S608 + f"(select {json_casting_selects} from '@~/target-snowflake/{sync_id}'" # noqa: S608 + f"(file_format => {file_format}) {dedup}) s " + f"on {join_expr} " @@ -431,7 +431,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: ISC003 + f"copy into {full_table_name} {col_alias_selects} from " # noqa: ISC003, S608 + f"(select {json_casting_selects} from " # noqa: S608 + f"'@~/target-snowflake/{sync_id}')" + f"file_format = (format_name='{file_format}')", diff --git a/tests/test_target_snowflake.py b/tests/test_target_snowflake.py index 8a20d9a..ac9e9ac 100644 --- a/tests/test_target_snowflake.py +++ b/tests/test_target_snowflake.py @@ -29,14 +29,14 @@ class BaseSnowflakeTargetTests: """Base class for Snowflake target tests.""" - @pytest.fixture() + @pytest.fixture def connection(self, runner): return runner.singer_class.default_sink_class.connector_class( runner.config, ).connection - @pytest.fixture() - def resource(self, runner, connection): # noqa: PT004 + @pytest.fixture + def resource(self, runner, connection): """Generic external resource. This fixture is useful for setup and teardown of external resources,