Skip to content

Commit

Permalink
Merge pull request #1623 from fishtown-analytics/feature/set-snowflak…
Browse files Browse the repository at this point in the history
…e-application-name

Set application name in snowflake connections
  • Loading branch information
drewbanin authored Jul 22, 2019
2 parents e46800f + e86c11e commit 8d4f2bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions plugins/snowflake/dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def open(cls, connection):
autocommit=False,
client_session_keep_alive=credentials.get(
'client_session_keep_alive', False),
application='dbt',
**auth_args
)

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

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

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

def test_authenticator_user_pass_authentication(self):
Expand All @@ -207,7 +208,8 @@ def test_authenticator_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',
authenticator='test_sso_url', private_key=None)
authenticator='test_sso_url', private_key=None,
application='dbt')
])

def test_authenticator_externalbrowser_authentication(self):
Expand All @@ -222,7 +224,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)
private_key=None, application='dbt')
])

@patch('dbt.adapters.snowflake.SnowflakeConnectionManager._get_private_key', return_value='test_key')
Expand All @@ -239,5 +241,6 @@ def test_authenticator_private_key_authentication(self, mock_get_private_key):
account='test_account', autocommit=False,
client_session_keep_alive=False, database='test_database',
role=None, schema='public', user='test_user',
warehouse='test_warehouse', private_key='test_key')
warehouse='test_warehouse', private_key='test_key',
application='dbt')
])

0 comments on commit 8d4f2bd

Please sign in to comment.