From d6ea416178020a012f14069e2fab0267cb57a60c Mon Sep 17 00:00:00 2001 From: abhishek-pattern Date: Mon, 4 May 2026 15:41:51 +0530 Subject: [PATCH 1/3] fix: set Snowflake warehouse via USE WAREHOUSE query and bump version to 0.4.2 Passing warehouse in Snowflake connection parameters silently fails to set it. Switched to executing USE WAREHOUSE as a raw query after connection is established. Co-Authored-By: Claude Sonnet 4.6 --- pyproject.toml | 2 +- src/ds_platform_utils/metaflow/snowflake_connection.py | 4 +++- uv.lock | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 83432b4..121b9cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ds-platform-utils" -version = "0.4.1" +version = "0.4.2" description = "Utility library for Pattern Data Science." readme = "README.md" authors = [ diff --git a/src/ds_platform_utils/metaflow/snowflake_connection.py b/src/ds_platform_utils/metaflow/snowflake_connection.py index 2b41107..047d6f1 100644 --- a/src/ds_platform_utils/metaflow/snowflake_connection.py +++ b/src/ds_platform_utils/metaflow/snowflake_connection.py @@ -80,11 +80,13 @@ def _create_snowflake_connection( conn: SnowflakeConnection = Snowflake( integration=SNOWFLAKE_INTEGRATION, client_session_keep_alive=True, - warehouse=warehouse, timezone="UTC" if use_utc else None, session_parameters={"QUERY_TAG": query_tag}, ).cn # type: ignore[attr-defined] + ## Doing this in the connection parameters result in silently failing to set the warehouse, so we have to execute a raw query to set it. + conn.execute_string("USE WAREHOUSE {}".format(warehouse)) + return conn diff --git a/uv.lock b/uv.lock index c15589d..a099e72 100644 --- a/uv.lock +++ b/uv.lock @@ -479,7 +479,7 @@ wheels = [ [[package]] name = "ds-platform-utils" -version = "0.4.1" +version = "0.4.2" source = { editable = "." } dependencies = [ { name = "jinja2" }, From 3d2871c8bab316f48f30f4bbd429ed2192223314 Mon Sep 17 00:00:00 2001 From: abhishek-pattern Date: Mon, 4 May 2026 15:45:25 +0530 Subject: [PATCH 2/3] Fix lint --- src/ds_platform_utils/metaflow/snowflake_connection.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ds_platform_utils/metaflow/snowflake_connection.py b/src/ds_platform_utils/metaflow/snowflake_connection.py index 047d6f1..1b20e62 100644 --- a/src/ds_platform_utils/metaflow/snowflake_connection.py +++ b/src/ds_platform_utils/metaflow/snowflake_connection.py @@ -84,8 +84,9 @@ def _create_snowflake_connection( session_parameters={"QUERY_TAG": query_tag}, ).cn # type: ignore[attr-defined] - ## Doing this in the connection parameters result in silently failing to set the warehouse, so we have to execute a raw query to set it. - conn.execute_string("USE WAREHOUSE {}".format(warehouse)) + # Doing this in the connection parameters result in silently failing to set the warehouse, + # so we have to execute a raw query to set it. + conn.execute_string("USE WAREHOUSE {}".format(warehouse)) return conn From ffc7a6db473a7610b8c3dad050542b68f0009fdd Mon Sep 17 00:00:00 2001 From: abhishek-pattern Date: Mon, 4 May 2026 15:45:42 +0530 Subject: [PATCH 3/3] fix lint --- src/ds_platform_utils/metaflow/snowflake_connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds_platform_utils/metaflow/snowflake_connection.py b/src/ds_platform_utils/metaflow/snowflake_connection.py index 1b20e62..8a17a8b 100644 --- a/src/ds_platform_utils/metaflow/snowflake_connection.py +++ b/src/ds_platform_utils/metaflow/snowflake_connection.py @@ -84,7 +84,7 @@ def _create_snowflake_connection( session_parameters={"QUERY_TAG": query_tag}, ).cn # type: ignore[attr-defined] - # Doing this in the connection parameters result in silently failing to set the warehouse, + # Doing this in the connection parameters result in silently failing to set the warehouse, # so we have to execute a raw query to set it. conn.execute_string("USE WAREHOUSE {}".format(warehouse))