rijojoseph07 commented on a change in pull request #14843:
URL: https://github.com/apache/superset/pull/14843#discussion_r641744412



##########
File path: superset/db_engine_specs/trino.py
##########
@@ -69,3 +69,37 @@ def adjust_database_uri(
             selected_schema = parse.quote(selected_schema, safe="")
             database = database.split("/")[0] + "/" + selected_schema
             uri.database = database
+
+    @classmethod
+    def update_impersonation_config(
+        cls, connect_args: Dict[str, Any], uri: str, username: Optional[str],
+    ) -> None:
+        """
+        Update a configuration dictionary
+        that can set the correct properties for impersonating users
+        :param connect_args: config to be updated
+        :param uri: URI string
+        :param impersonate_user: Flag indicating if impersonation is enabled
+        :param username: Effective username
+        :return: None
+        """
+        url = make_url(uri)
+        backend_name = url.get_backend_name()
+
+        # Must be Presto connection, enable impersonation, and set optional 
param

Review comment:
       this is called only if impersonation is enabled 
   
   _// from core.py_
   ```
   if self.impersonate_user:
               self.db_engine_spec.update_impersonation_config(
                   connect_args, str(sqlalchemy_url), effective_username
               )
   ```
   
   modify_url will work only if authentication is disabled - we will have to 
modify connection args to pass logged In user_name based on the underlying 
connector - for presto, its `principal_username` and for trino its `user`. 




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

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