martin
martin

Reputation: 1185

How to connect superset to druid?

I want to create project with kafka + druid + superset working together.

I created 3 docker compose each for tool. Now I have a kafka with some test data, working druid, and working (on demo data) superset. All avaible locally.

What is a problem?

I try to connect superset with test datasource i druid.

I pick in superset "Connect to database", choose Apache druid and fill: SQLALCHEMY URI as:

druid://localhost:8082/druid/v2/sql/
druid+http://localhost:8082/druid/v2/sql/
druid+https://localhost:8082/druid/v2/sql/
druid+https://172.19.0.7:8082/druid/v2/sql/

But it's generate:

ERROR: (builtins.NoneType) None
(Background on this error at: https://sqlalche.me/e/14/dbapi)

Only last one generate timeout.

I was wondering if something is wrong with my druid so I create script:

from pydruid.db import connect

conn = connect(host='localhost', port=8082, path='/druid/v2/sql/', scheme='http')

cursor = conn.cursor()
print(cursor.url)
query = "SELECT * FROM test LIMIT 10"

cursor.execute(query)

rows = cursor.fetchall()

for row in rows:
    print(row)

cursor.close()
conn.close()

But this code works perfecty fine, returning data normally.

Have any one any idea why I can't connect through superset?

This is my docker-compose for superset:

version: '3.7'
services:
  superset:
    image: apache/superset
    container_name: superset
    ports:
      - "8088:8088"
    environment:
      SUPERSET_LOAD_EXAMPLES: 'yes'  # Load examples to explore Superset features
      SUPERSET_DB_URI: 'sqlite:////superset/superset.db'  # Using SQLite for simplicity
      SUPERSET_SECRET_KEY: 'dsadsadsadsadasdas'
    volumes:
      - superset_home:/superset
    command: ["superset", "run", "-h", "0.0.0.0", "-p", "8088", "--with-threads", "--reload", "--debugger"]

volumes:
  superset_home:

Upvotes: 1

Views: 92

Answers (0)

Related Questions