mistercrunch commented on a change in pull request #3697: DI-1113. ADDENDUM. 
Authentication: Enable user impersonation for Superset to HiveServer2 using 
hive.server2.proxy.user (a.fernandez)
URL: 
https://github.com/apache/incubator-superset/pull/3697#discussion_r147004332
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -1439,20 +1440,28 @@ def testconn(self):
                     # the password-masked uri was passed
                     # use the URI associated with this database
                     uri = database.sqlalchemy_uri_decrypted
+
+            configuration = {}
+
+            if database is not None and uri is not None:
+                url = make_url(uri)
+                db_engine = 
models.Database.get_db_engine_spec_for_backend(url.get_backend_name())
+                db_engine.patch()
             
-            url = make_url(uri)
-            db_engine = 
models.Database.get_db_engine_spec_for_backend(url.get_backend_name())
-            db_engine.patch()
-            uri = db_engine.get_uri_for_impersonation(uri, impersonate_user, 
username)
-            masked_url = database.get_password_masked_url_from_uri(uri)
+                masked_url = database.get_password_masked_url_from_uri(uri)
+                logging.info("Superset.testconn(). Masked URL: 
{0}".format(masked_url))
 
-            logging.info("Superset.testconn(). Masked URL: 
{0}".format(masked_url))
+                
configuration.update(db_engine.get_configuration_for_impersonation(uri, 
impersonate_user, username))
 
             connect_args = (
                 request.json
                 .get('extras', {})
                 .get('engine_params', {})
                 .get('connect_args', {}))
+
+            if len(configuration.keys()) > 0:
 
 Review comment:
   Same as "pythonesquier" `if configurations:`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to