kaxil commented on code in PR #77733:
URL: https://github.com/apache/airflow/pull/77733#discussion_r4760847870


##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -259,6 +259,9 @@ class SnowflakeHook(DbApiHook):
     :param account: snowflake account name
     :param authenticator: authenticator for Snowflake.
         'snowflake' (default) to use the internal Snowflake authenticator
+        'oauth' to authenticate with an OAuth access token or refresh token

Review Comment:
   Small wording thing on the new `'oauth'` line: with `oauth` the hook always 
fetches the access token itself, from the connection's grant (`refresh_token`, 
`client_credentials` or `password`) or from `azure_conn_id`, so a token the 
user already has isn't used. Maybe "'oauth' to authenticate with an OAuth token 
fetched using the connection's grant type or azure_conn_id", and the 
`'workload_identity'` line could mention that the connection extra also needs 
`workload_identity_provider`, in all nine copies?



##########
providers/snowflake/src/airflow/providers/snowflake/hooks/snowflake.py:
##########
@@ -532,7 +535,9 @@ def _build_base_conn_config(
 
         schema = conn.schema or ""
 
-        authenticator = (self._get_field(extra_dict, "authenticator") or 
"").strip() or "snowflake"
+        authenticator = (
+            self.authenticator or self._get_field(extra_dict, "authenticator") 
or ""

Review Comment:
   This also lower-cases the constructor argument for `oauth` and 
`programmatic_access_token` now, so `SnowflakeHook(authenticator="OAUTH")` 
starts taking the OAuth path. Only the WIF case is covered, through 
`_rest_auth`; could a sibling of 
`test_get_conn_params_authenticator_from_extra` cover a couple of 
constructor-argument cases, including one where the argument overrides an extra 
with different casing?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to