Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update connections.py #49

Merged
merged 7 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
## dbt-snowflake 1.0.0 (Release TBD)

## dbt-snowflake 1.0.0rc2 (TBD)

### Fixes
- Apply query tags for Seed and Snapshot materialisations ([#48](https://github.com/dbt-labs/dbt-snowflake/issues/48))
- Apply query tags for Seed and Snapshot materialisations ([#20](https://github.com/dbt-labs/dbt-snowflake/issues/20), [#48](https://github.com/dbt-labs/dbt-snowflake/issues/48))

### Under the hood
- Resolves an issue caused when the Snowflake OCSP server is not accessible, by exposing the `insecure_mode` boolean avalable in the Snowflake python connector ([#31](https://github.com/dbt-labs/dbt-snowflake/issues/31), [#49](https://github.com/dbt-labs/dbt-snowflake/pull/49))

### Contributors
- [@anthu](https://github.com/anthu) ([#48](https://github.com/dbt-labs/dbt-snowflake/pull/48))
- [@JoshuaHuntley](https://github.com/JoshuaHuntley) ([#49](https://github.com/dbt-labs/dbt-snowflake/pull/49))

## dbt-snowflake 1.0.0rc1 (November 10, 2021)

Expand Down
2 changes: 2 additions & 0 deletions dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SnowflakeCredentials(Credentials):
connect_timeout: int = 10
retry_on_database_errors: bool = False
retry_all: bool = False
insecure_mode: Optional[bool] = False

def __post_init__(self):
if (
Expand Down Expand Up @@ -252,6 +253,7 @@ def open(cls, connection):
autocommit=True,
client_session_keep_alive=creds.client_session_keep_alive,
application='dbt',
insecure_mode=creds.insecure_mode,
**creds.auth_args()
)

Expand Down
16 changes: 8 additions & 8 deletions tests/unit/test_snowflake_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def test_client_session_keep_alive_false_by_default(self):
account='test_account', autocommit=True,
client_session_keep_alive=False, database='test_database',
role=None, schema='public', user='test_user',
warehouse='test_warehouse', private_key=None, application='dbt')
warehouse='test_warehouse', private_key=None, application='dbt', insecure_mode=False)
])

def test_client_session_keep_alive_true(self):
Expand All @@ -277,7 +277,7 @@ def test_client_session_keep_alive_true(self):
account='test_account', autocommit=True,
client_session_keep_alive=True, database='test_database',
role=None, schema='public', user='test_user',
warehouse='test_warehouse', private_key=None, application='dbt')
warehouse='test_warehouse', private_key=None, application='dbt', insecure_mode=False)
])

def test_user_pass_authentication(self):
Expand All @@ -295,7 +295,7 @@ def test_user_pass_authentication(self):
client_session_keep_alive=False, database='test_database',
password='test_password', role=None, schema='public',
user='test_user', warehouse='test_warehouse', private_key=None,
application='dbt')
application='dbt', insecure_mode=False)
])

def test_authenticator_user_pass_authentication(self):
Expand All @@ -315,7 +315,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', client_store_temporary_credential=True)
application='dbt', client_store_temporary_credential=True, insecure_mode=False)
])

def test_authenticator_externalbrowser_authentication(self):
Expand All @@ -333,7 +333,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', client_store_temporary_credential=True)
private_key=None, application='dbt', client_store_temporary_credential=True, insecure_mode=False)
])

def test_authenticator_oauth_authentication(self):
Expand All @@ -352,7 +352,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', client_store_temporary_credential=True)
private_key=None, application='dbt', client_store_temporary_credential=True, insecure_mode=False)
])

@mock.patch('dbt.adapters.snowflake.SnowflakeCredentials._get_private_key', return_value='test_key')
Expand All @@ -373,7 +373,7 @@ def test_authenticator_private_key_authentication(self, mock_get_private_key):
client_session_keep_alive=False, database='test_database',
role=None, schema='public', user='test_user',
warehouse='test_warehouse', private_key='test_key',
application='dbt')
application='dbt', insecure_mode=False)
])

@mock.patch('dbt.adapters.snowflake.SnowflakeCredentials._get_private_key', return_value='test_key')
Expand All @@ -394,7 +394,7 @@ def test_authenticator_private_key_authentication_no_passphrase(self, mock_get_p
client_session_keep_alive=False, database='test_database',
role=None, schema='public', user='test_user',
warehouse='test_warehouse', private_key='test_key',
application='dbt')
application='dbt', insecure_mode=False)
])


Expand Down