能否将Apache Superset的SQL数据库连接指向Druid集群?及接入方法咨询
Druid Cluster as SQL Database in Apache Superset: Answers to Your Questions
Hey there! Let's break down your questions about using Druid with Apache Superset step by step.
Can you point your SQL database connection directly to a Druid cluster?
Absolutely! Druid has native support for SQL queries (powered by Apache Calcite), so you can treat it like a SQL database for connection purposes. That said, keep a few key notes in mind:
- Druid's SQL is optimized for OLAP/analytics workloads—it shines for aggregation, time-series queries, and large-scale data exploration. It’s not built for transactional operations (like row-by-row
INSERT/UPDATE) that you’d use with traditional relational databases. - There are minor syntax differences from standard SQL. For example, handling time dimensions (Druid relies heavily on timestamp columns for partitioning) or using Druid-specific functions like
APPROX_COUNT_DISTINCTinstead ofCOUNT(DISTINCT)for large datasets. If you’re migrating existing SQL queries, you might need to tweak them to fit Druid’s capabilities.
How to connect Druid as a SQL database to Apache Superset?
Connecting Druid to Superset is straightforward—here’s a step-by-step guide:
- First, confirm dependencies: Most standard Superset installations include the Druid connector out of the box. If you’re running a custom setup, install the required dependency with:
pip install apache-superset[druid] - Log into Superset: Navigate to the Data menu, then select Databases.
- Create a new database connection: Click the + Database button in the top-right corner.
- Select the Druid connector: From the "Connect a database" dropdown, choose Apache Druid.
- Configure the connection URI:
- The base format is:
druid://<druid_broker_host>:<druid_broker_port>/druid/v2/sql/- Example for a local Druid instance:
druid://localhost:8888/druid/v2/sql/(Druid Broker’s default port is 8888)
- Example for a local Druid instance:
- If your Druid cluster uses authentication (e.g., Basic Auth), add credentials to the URI:
druid://<username>:<password>@<druid_broker_host>:<druid_broker_port>/druid/v2/sql/ - For TLS-encrypted connections, use
druid+s://instead ofdruid://, and configure any required SSL certificate settings in the "Advanced" tab if needed.
- The base format is:
- Test and save: Click Test Connection to verify Superset can reach your Druid cluster. If the test passes, give your database a descriptive name (e.g., "Production Druid Cluster") and hit Save.
Once connected, you can use Superset’s SQL Lab to write and run Druid SQL queries, create datasets from Druid tables, and build dashboards just like you would with any other SQL database.
内容的提问来源于stack exchange,提问作者Climbs_lika_Spyder
相关产品推荐
相关产品推荐

