You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/06 10:20:15 UTC

[GitHub] [incubator-superset] tjmateus commented on a change in pull request #9405: Added support for impersonation on SQL Server databases using the pym…

tjmateus commented on a change in pull request #9405: Added support for impersonation on SQL Server databases using the pym…
URL: https://github.com/apache/incubator-superset/pull/9405#discussion_r403982261
 
 

 ##########
 File path: superset/db_engine_specs/mssql.py
 ##########
 @@ -76,3 +77,16 @@ def get_sqla_column_type(cls, type_: str) -> Optional[TypeEngine]:
             if regex.match(type_):
                 return sqla_type
         return None
+
+    @classmethod
+    def modify_url_for_impersonation(
+        cls, url: URL, impersonate_user: bool, username: Optional[str]
+    ) -> None:
+        """
+        Modify the SQL Alchemy URL object with the user to impersonate if applicable.
+        :param url: SQLAlchemy URL object
+        :param impersonate_user: Flag indicating if impersonation is enabled
+        :param username: Effective username
+        """
+        if impersonate_user and username is not None:
+            url.query["conn_properties"] = "EXECUTE AS USER = '{}'".format(username)
 
 Review comment:
   Hi @villebro, did you have a chance to think on my question? Thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org