From 6b0e6aa4235d2e59abcb34a1fdb30d28a9de166c Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 4 Nov 2022 10:35:19 -0500 Subject: [PATCH] convert warn_or_error to use specific event --- dbt/adapters/snowflake/connections.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dbt/adapters/snowflake/connections.py b/dbt/adapters/snowflake/connections.py index 107574108..e7e7a0050 100644 --- a/dbt/adapters/snowflake/connections.py +++ b/dbt/adapters/snowflake/connections.py @@ -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") @@ -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 @@ -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