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

convert warn_or_error to use specific event #309

Merged
merged 1 commit into from
Nov 4, 2022
Merged
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
18 changes: 11 additions & 7 deletions dbt/adapters/snowflake/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
RuntimeException,
FailedToConnectException,
DatabaseException,
warn_or_error,
)
from dbt.adapters.base import Credentials # type: ignore
from dbt.contracts.connection import AdapterResponse
from dbt.adapters.sql import SQLConnectionManager # type: ignore
from dbt.events import AdapterLogger # type: ignore
from dbt.events.functions import warn_or_error
from dbt.events.types import AdapterEventWarning


logger = AdapterLogger("Snowflake")
Expand Down Expand Up @@ -83,8 +84,9 @@ def __post_init__(self):
):
# the user probably forgot to set 'authenticator' like I keep doing
warn_or_error(
"Authenticator is not set to oauth, but an oauth-only "
"parameter is set! Did you mean to set authenticator: oauth?"
AdapterEventWarning(
base_msg="Authenticator is not set to oauth, but an oauth-only parameter is set! Did you mean to set authenticator: oauth?"
)
)

@property
Expand Down Expand Up @@ -132,13 +134,15 @@ def auth_args(self):
token = self._get_access_token()
elif self.oauth_client_id:
warn_or_error(
"Invalid profile: got an oauth_client_id, but not an "
"oauth_client_secret!"
AdapterEventWarning(
base_msg="Invalid profile: got an oauth_client_id, but not an oauth_client_secret!"
)
)
elif self.oauth_client_secret:
warn_or_error(
"Invalid profile: got an oauth_client_secret, but not "
"an oauth_client_id!"
AdapterEventWarning(
base_msg="Invalid profile: got an oauth_client_secret, but not an oauth_client_id!"
)
)

result["token"] = token
Expand Down