villebro commented on a change in pull request #9396: feat: add SSL certificate 
validation for Druid
URL: 
https://github.com/apache/incubator-superset/pull/9396#discussion_r398613816
 
 

 ##########
 File path: superset/db_engine_specs/druid.py
 ##########
 @@ -47,3 +49,18 @@ class DruidEngineSpec(BaseEngineSpec):  # pylint: 
disable=abstract-method
     def alter_new_orm_column(cls, orm_col: "TableColumn") -> None:
         if orm_col.column_name == "__time":
             orm_col.is_dttm = True
+
+    @classmethod
+    def mutate_connection_args(
+        cls, database: "Database", connect_args: Dict[str, Any]
+    ) -> None:
+        """
+        Some databases require passing additional non-standard parameters to 
database
+        connections, for example client certificates.
+
+        :param database: instance to be mutated
+        """
+        if database.server_cert:
+            connect_args["scheme"] = "https"
+            path = utils.create_temporary_ssl_cert_file(database.server_cert)
+            connect_args["ssl_verify_cert"] = path
 
 Review comment:
   Good idea. This raises `ValueError` if it doesn't validate, and it could be 
really helpful to have a specific `Exception` for that case, e.g. in the `Test 
Connection` where I suspect most people will hit errors.

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


With regards,
Apache Git Services

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

Reply via email to