SQLAlchemy URI (in superset) to connect to SSL enabled DRUI UI

1,819 views
Skip to first unread message

Lakshman Pervatoj

unread,
Mar 24, 2020, 8:15:48 PM3/24/20
to sqlalchemy

Hi Everyone,

Using SQLAlchemy I want to connect to Apache Druid DB through Druid UI which is SSL enabled and also has local authentication


druid+https://<local_authentication_ID>:<password>@<server>:<port>/druid/v2/sql/


And getting the below error:


ERROR: {"error": "Connection failed!\n\nThe error message returned was:\nHTTPSConnectionPool(host=‘<server’>, port=<port>): Max retries exceeded with url: /druid/v2/sql/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate 


How can we pass the certs

Simon King

unread,
Mar 25, 2020, 6:50:35 AM3/25/20
to sqlal...@googlegroups.com
I've never used Druid, but this is really a question for the pydruid
project, I don't know if any of those developers are on this list. It
looks like pydruid only recently started supporting self-signed
certificates (or allowing you to ignore certificate errors):

https://github.com/druid-io/pydruid/pull/180/files

The value of the "ssl_verify_cert" parameter gets passed as the
"verify" parameter to requests.post:

http://2.python-requests.org/en/v1.1.0/user/advanced/#ssl-cert-verification

Unfortunately, it doesn't look like the pydruid sqlalchemy adapter
allows the ssl_verify_cert option to be specified in the url:

https://github.com/druid-io/pydruid/blob/master/pydruid/db/sqlalchemy.py#L121

You might be able to use the connect_args option to create_engine:

https://docs.sqlalchemy.org/en/13/core/engines.html#custom-dbapi-connect-arguments

or you could use the "creator" argument to specify your own function
for creating the connection:

https://docs.sqlalchemy.org/en/13/core/engines.html#sqlalchemy.create_engine.params.creator

Hope that helps,

Simon
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
> ---
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/c95ac471-9bdc-42bb-8121-82c8a62466f7%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages