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

Set application name in snowflake connections #1623

Merged
merged 1 commit into from
Jul 22, 2019
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
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')
])