From c5a19ca42ea85f92fd473f03bbd94e47714fb7a4 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Wed, 12 Aug 2020 13:56:10 -0600 Subject: [PATCH 1/2] bump requirements, enable the token cache --- CHANGELOG.md | 4 ++++ core/setup.py | 6 +++--- plugins/snowflake/dbt/adapters/snowflake/connections.py | 2 ++ plugins/snowflake/setup.py | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a587aeb02..bd5127e6f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - `adapter_macro` is no longer a macro, instead it is a builtin context method. Any custom macros that intercepted it by going through `context['dbt']` will need to instead access it via `context['builtins']` ([#2302](https://github.com/fishtown-analytics/dbt/issues/2302), [#2673](https://github.com/fishtown-analytics/dbt/pull/2673)) - `adapter_macro` is now deprecated. Use `adapter.dispatch` instead. + +### Under the hood +- Upgraded snowflake-connector-python dependency to 2.2.10 and enabled the SSO token cache ([#2613](https://github.com/fishtown-analytics/dbt/issues/2613), [#2689](https://github.com/fishtown-analytics/dbt/issues/2689), [#2698](https://github.com/fishtown-analytics/dbt/pull/2698)) + ### Features - Added a `dispatch` method to the context adapter and deprecated `adapter_macro`. ([#2302](https://github.com/fishtown-analytics/dbt/issues/2302), [#2679](https://github.com/fishtown-analytics/dbt/pull/2679)) - The built-in schema tests now use `adapter.dispatch`, so they can be overridden for adapter plugins ([#2415](https://github.com/fishtown-analytics/dbt/issues/2415), [#2684](https://github.com/fishtown-analytics/dbt/pull/2684)) diff --git a/core/setup.py b/core/setup.py index cfc50bf6864..68bf6f0ae0a 100644 --- a/core/setup.py +++ b/core/setup.py @@ -68,9 +68,9 @@ def read(fname): 'logbook>=1.5,<1.6', 'typing-extensions>=3.7.4,<3.8', # the following are all to match snowflake-connector-python - 'requests>=2.18.0,<2.23.0', - 'idna<2.9', - 'cffi>=1.9,<1.14', + 'requests>=2.18.0,<2.24.0', + 'idna<2.10', + 'cffi>=1.9,<1.15', ], zip_safe=False, classifiers=[ diff --git a/plugins/snowflake/dbt/adapters/snowflake/connections.py b/plugins/snowflake/dbt/adapters/snowflake/connections.py index da2c303a4c0..1d83d044a1a 100644 --- a/plugins/snowflake/dbt/adapters/snowflake/connections.py +++ b/plugins/snowflake/dbt/adapters/snowflake/connections.py @@ -88,6 +88,8 @@ def auth_args(self): ) result['token'] = token + # enable the token cache + result['client_store_temporary_credential'] = True result['private_key'] = self._get_private_key() return result diff --git a/plugins/snowflake/setup.py b/plugins/snowflake/setup.py index a9b2e81bb38..2fc5d682494 100644 --- a/plugins/snowflake/setup.py +++ b/plugins/snowflake/setup.py @@ -41,9 +41,9 @@ }, install_requires=[ 'dbt-core=={}'.format(package_version), - 'snowflake-connector-python==2.2.1', + 'snowflake-connector-python==2.2.10', 'azure-common<2.0.0', - 'azure-storage-blob<12.0.0', + 'azure-storage-blob>=12.0.0,<13.0.0', 'urllib3>=1.20,<1.26.0', # this seems sufficiently broad 'cryptography>=2,<3', From 3555ba518d879c636ee1709bb288e741e35ab6e8 Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Wed, 12 Aug 2020 14:07:20 -0600 Subject: [PATCH 2/2] fix unit tests --- test/unit/test_snowflake_adapter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/test_snowflake_adapter.py b/test/unit/test_snowflake_adapter.py index 131e005f40c..d9da303fd63 100644 --- a/test/unit/test_snowflake_adapter.py +++ b/test/unit/test_snowflake_adapter.py @@ -302,7 +302,7 @@ def test_authenticator_user_pass_authentication(self): password='test_password', role=None, schema='public', user='test_user', warehouse='test_warehouse', authenticator='test_sso_url', private_key=None, - application='dbt') + application='dbt', client_store_temporary_credential=True) ]) def test_authenticator_externalbrowser_authentication(self): @@ -320,7 +320,7 @@ def test_authenticator_externalbrowser_authentication(self): client_session_keep_alive=False, database='test_database', role=None, schema='public', user='test_user', warehouse='test_warehouse', authenticator='externalbrowser', - private_key=None, application='dbt') + private_key=None, application='dbt', client_store_temporary_credential=True) ]) def test_authenticator_oauth_authentication(self): @@ -339,7 +339,7 @@ def test_authenticator_oauth_authentication(self): client_session_keep_alive=False, database='test_database', role=None, schema='public', user='test_user', warehouse='test_warehouse', authenticator='oauth', token='my-oauth-token', - private_key=None, application='dbt') + private_key=None, application='dbt', client_store_temporary_credential=True) ]) @mock.patch('dbt.adapters.snowflake.SnowflakeCredentials._get_private_key', return_value='test_key')