diff --git a/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml b/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml new file mode 100644 index 000000000..2ef19bfe0 --- /dev/null +++ b/dbt-snowflake/.changes/unreleased/Dependencies-20251010-095457.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Upgrade snowflake-connector-python to 4.0.0 +time: 2025-10-10T09:54:57.268488-05:00 +custom: + Author: wiggzz + PR: "1368" diff --git a/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml b/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml new file mode 100644 index 000000000..a26807230 --- /dev/null +++ b/dbt-snowflake/.changes/unreleased/Fixes-20251003-140016.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Set client prefetch threads to 1 to prevent deadlock at exit +time: 2025-10-03T14:00:16.074315-05:00 +custom: + Author: wiggzz + Issue: "1368" diff --git a/dbt-snowflake/pyproject.toml b/dbt-snowflake/pyproject.toml index 572b78f35..bebfccad9 100644 --- a/dbt-snowflake/pyproject.toml +++ b/dbt-snowflake/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "dbt-common>=1.10,<2.0", "dbt-adapters>=1.16.6,<2.0", # lower bound pin due to CVE-2025-24794 - "snowflake-connector-python[secure-local-storage]>=3.13.1,<4.0.0", + "snowflake-connector-python[secure-local-storage]>=4.0.0,<5.0.0", "certifi<2025.4.26", # add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency "dbt-core>=1.10.0rc0", diff --git a/dbt-snowflake/src/dbt/adapters/snowflake/connections.py b/dbt-snowflake/src/dbt/adapters/snowflake/connections.py index b83032a76..a1c173ea4 100644 --- a/dbt-snowflake/src/dbt/adapters/snowflake/connections.py +++ b/dbt-snowflake/src/dbt/adapters/snowflake/connections.py @@ -394,6 +394,7 @@ def connect(): application="dbt", insecure_mode=creds.insecure_mode, session_parameters=session_parameters, + ocsp_root_certs_dict_lock_timeout=10, # cert lock can cause deadlock without timeout, see https://github.com/snowflakedb/snowflake-connector-python/issues/2213 **creds.auth_args(), ) diff --git a/dbt-snowflake/tests/unit/test_snowflake_adapter.py b/dbt-snowflake/tests/unit/test_snowflake_adapter.py index 3a7cac5be..c3d83df4f 100644 --- a/dbt-snowflake/tests/unit/test_snowflake_adapter.py +++ b/dbt-snowflake/tests/unit/test_snowflake_adapter.py @@ -292,6 +292,7 @@ def test_client_session_keep_alive_false_by_default(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ), ] ) @@ -325,6 +326,7 @@ def test_client_session_keep_alive_true(self): insecure_mode=False, session_parameters={}, reuse_connections=None, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -352,6 +354,7 @@ def test_client_has_query_tag(self): application="dbt", insecure_mode=False, session_parameters={"QUERY_TAG": "test_query_tag"}, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -387,6 +390,7 @@ def test_user_pass_authentication(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -421,6 +425,7 @@ def test_authenticator_user_pass_authentication(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -451,6 +456,7 @@ def test_authenticator_externalbrowser_authentication(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -485,6 +491,7 @@ def test_authenticator_oauth_authentication(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -519,6 +526,7 @@ def test_authenticator_private_key_authentication(self, mock_get_private_key): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -553,6 +561,7 @@ def test_authenticator_private_key_authentication_no_passphrase(self, mock_get_p insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -585,6 +594,7 @@ def test_authenticator_jwt_authentication(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -615,6 +625,7 @@ def test_query_tag(self): insecure_mode=False, session_parameters={"QUERY_TAG": "test_query_tag"}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -644,6 +655,7 @@ def test_reuse_connections_with_keep_alive(self): insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -678,6 +690,7 @@ def test_authenticator_private_key_string_authentication(self, mock_get_private_ insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] ) @@ -714,6 +727,7 @@ def test_authenticator_private_key_string_authentication_no_passphrase( insecure_mode=False, session_parameters={}, reuse_connections=True, + ocsp_root_certs_dict_lock_timeout=10, ) ] )