This repo demonstrates how to connect the open source Vanna library to a locally running Apache Druid instance using SQLAlchemy and PyDruid.
Vanna AI is a lightweight, open-source Python library that translates natural language questions into SQL queries for your database.
- Runs Apache Druid locally (via its quickstart)
- Connects Vanna to Druid using the
pydruid
SQLAlchemy dialect - Lets you ask natural language questions and get back query results
vanna_druid.py
: The full working example that:- Connects to a local Druid instance
- Trains Vanna with a couple of example queries
- Runs a natural language question end-to-end
-
Python 3.8+
-
Apache Druid running locally (use
start-micro-quickstart
) -
Install required packages:
pip install vanna openai sqlalchemy pydruid pandas chromadb
-
Start Druid:
export DRUID_SKIP_PORT_CHECK=1 export DRUID_SKIP_JAVA_CHECK=1 bin/start-micro-quickstart
-
Run the Vanna example:
python vanna_druid.py
-
Ask natural language questions like:
What are the top 5 most active Wikipedia channels?
We can provide a Docker container that runs Vanna in the same network as your Druid deployment. Just reach out via GitHub Issues or vanna.ai.
- Vanna GitHub: https://github.com/vanna-ai/vanna
- Apache Druid: https://druid.apache.org/