diff --git a/dbt/adapters/snowflake/connections.py b/dbt/adapters/snowflake/connections.py index 1d6e31c93..aca115b4b 100644 --- a/dbt/adapters/snowflake/connections.py +++ b/dbt/adapters/snowflake/connections.py @@ -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): diff --git a/tests/unit/test_connections.py b/tests/unit/test_connections.py index 555091c57..dd452b3cb 100644 --- a/tests/unit/test_connections.py +++ b/tests/unit/test_connections.py @@ -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"