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

Allow user to be omitted if using authenticator #866

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 5 additions & 2 deletions dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class SnowflakeAdapterResponse(AdapterResponse):
@dataclass
class SnowflakeCredentials(Credentials):
account: str
user: str
user: Optional[str] = None
warehouse: Optional[str] = None
role: Optional[str] = None
password: Optional[str] = None
Expand Down Expand Up @@ -148,6 +148,8 @@ def auth_args(self):
# Pull all of the optional authentication args for the connector,
# let connector handle the actual arg validation
result = {}
if self.user:
result["user"] = self.user
if self.password:
result["password"] = self.password
if self.host:
Expand Down Expand Up @@ -186,6 +188,8 @@ def auth_args(self):
result["client_store_temporary_credential"] = True
# enable mfa token cache for linux
result["client_request_mfa_token"] = True
elif not self.user:
raise DbtInternalError("user must be set if authenticator is not")
result["reuse_connections"] = self.reuse_connections
result["private_key"] = self._get_private_key()
return result
Expand Down Expand Up @@ -348,7 +352,6 @@ def connect():

handle = snowflake.connector.connect(
account=creds.account,
user=creds.user,
database=creds.database,
schema=creds.schema,
warehouse=creds.warehouse,
Expand Down