rusackas commented on code in PR #36856:
URL: https://github.com/apache/superset/pull/36856#discussion_r3686026884


##########
superset/db_engine_specs/snowflake.py:
##########
@@ -440,6 +605,18 @@ def update_params_from_encrypted_extra(
         database: "Database",
         params: dict[str, Any],
     ) -> None:
+        # To use OAuth authentication, a database connection must first be 
created using
+        # another authenticator (typically key-pair authentication)
+        # with “Impersonate logged in user” enabled.
+        # Key-pair authentication is used for connection tests,
+        # while OAuth authentication is used when executing actual queries,
+        # such as in SQL Lab or dashboards.
+        # Therefore, when using OAuth authentication, the key-pair 
authentication
+        # settings are not loaded, and the connection is established using 
OAuth only.
+        connect_args: dict[str, Any] = params.get("connect_args") or {}
+        if connect_args.get("authenticator") == "oauth":
+            return

Review Comment:
   Codeant's right that this function can't see the URL query string on its 
own, but it doesn't need to. It only ever runs after `impersonate_user`, which 
already sets `connect_args["authenticator"] = "oauth"` on the same 
`engine_kwargs` dict first (see `models/core.py` around line 679). So the guard 
does catch the case that actually matters here.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to