10

I currently connect to the druid cluster through the druid connector in Apache Superset. I heard that SQL can be used to query druid. Is it possible to point my SQL database connection to druid?

Climbs_lika_Spyder
  • 6,004
  • 3
  • 39
  • 53

2 Answers2

17

Follow the steps below

  1. You need to use latest version of pydruid for enabling sqlalchemy support. For me pydruid 0.4.1 is working fine.

  2. On Superset, in the Databases section you need to provide the SQLAlchemy URI druid://XX.XX:8082/druid/v2/sql/using a broker ip/host.

  3. Third thing you need to do is to enable druid.sql.enable=true on broker.

I hope this will help you.

Nayan Sharma
  • 1,823
  • 18
  • 19
  • 1
    Sweet, I will try this out. Getting the enable piece may take a bit. I will accept your answer once I am able to fully test it. – Climbs_lika_Spyder May 10 '18 at 17:47
  • 2
    It is in the `Databases` section under `Sources`, and not `Datasources` (which is also present, but it's not what you'd want). – John Strood May 24 '18 at 10:23
  • 1
    @JohnStrood Thanks John. I have made the changes. – Nayan Sharma Jun 14 '18 at 11:44
  • I tried HDP 2.6.5 with pydruid 0.4.5 installed then restarted superset, but still has "Can't load plugin: sqlalchemy.dialects:druid" error,why? – Casel Chen Sep 17 '18 at 02:35
  • 1
    I recently faced the same problem and this answer helped me. One thing to add, I don't know if this is new since this question was asked a year ago. You'd need to enable `Expose in SQL Lab` now in when you add source->databases – Chengzhi Apr 19 '19 at 20:29
  • And if you have basic auth setup you can also use the form: druid://admin:pass@druid-host:8082/druid/v2/sql/ – rimkashox Aug 19 '20 at 14:13
5

i was really struggling with this one... in my case, i am running on my mac. druid is installed directly and superset is running in docker (using the docker-compose setup).

the key is that localhost in the superset docker container doesn't point at the host, but instead at the docker container.

when i changed the superset datasource to this, it worked...

druid://host.docker.internal:8082/druid/v2/sql/
Datum Geek
  • 1,358
  • 18
  • 23