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

replace underscores with hyphens in account ids #1067

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 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"
Loading