Skip to content

Commit

Permalink
replace underscores with hyphens in account ids
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt committed Jun 4, 2024
1 parent 4ff6bdb commit 62f7594
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def __post_init__(self):
base_msg="Authenticator is not set to oauth, but an oauth-only parameter is set! Did you mean to set authenticator: oauth?"
)
)
self.account = self.account.replace("_", "-")

@property
def type(self):
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ def test_connections_does_not_set_logs_in_response_to_env_var(monkeypatch):

assert log_mock.debug.call_count == 0
assert log_mock.set_adapter_dependency_log_level.call_count == 0


def test_connnections_credentials_replaces_underscores_with_hyphens():
credentials = {
"account": "account_id_with_underscores",
"user": "user",
"password": "password",
"database": "database",
"warehouse": "warehouse",
"schema": "schema",
}
creds = connections.SnowflakeCredentials(**credentials)
assert creds.account == "account-id-with-underscores"

0 comments on commit 62f7594

Please sign in to comment.