"What were our top 10 customers last quarter by revenue, as a bar chart?"
DB-GPT translates that to SQL, runs it against your database, and renders the chart. No SQL knowledge required. Fully local. MIT licensed. 17K GitHub stars โ almost no English content.
What is DB-GPT?
DB-GPT is an open-source framework that puts a natural language interface on top of your databases. You connect PostgreSQL, MySQL, SQLite, or others โ then ask questions in plain English. It generates the SQL, executes it, and can visualize results automatically.
Think Metabase meets AI, but fully self-hosted and free.
Supported Databases
PostgreSQL ยท MySQL ยท MariaDB ยท SQLite ยท ClickHouse ยท DuckDB ยท Spark SQL
Setup
Clone the repo, copy .env.example to .env, add your database connection string, then docker compose up -d. Open localhost:5670 โ admin / admin โ Settings โ Database โ Add โ paste connection string.
Full docker-compose: chinese-ai-tools-english-guide/tools/db-gpt
Example Queries
Once your database is connected:
- "Show total sales by month for the last 12 months as a bar chart"
- "Which products have inventory below 10 units?"
- "Top 5 customers by order value with their email addresses"
- "Average order fulfillment time grouped by warehouse"
DB-GPT generates SQL for each, runs it, returns results. Charts render automatically in the UI.
Connecting Ollama
Settings โ LLM Provider โ Ollama โ Base URL: http://ollama:11434/v1 โ Model: llama3
For best SQL accuracy use sqlcoder โ fine-tuned specifically for SQL generation. Pull it with docker exec -it ollama ollama pull sqlcoder.
DB-GPT vs Vanna.ai
Both let you query databases with natural language:
| DB-GPT | Vanna.ai | |
|---|---|---|
| License | MIT | MIT |
| Built-in UI | โ Full app | Minimal |
| Charts | โ Built-in | โ External |
| Visual pipeline | โ AWEL | โ |
| Self-hosted | โ | โ |
DB-GPT if you want a complete self-contained app. Vanna.ai if you're embedding the capability programmatically into your own product.
n8n Automation
A ready-to-import workflow JSON is in the repo (integration/n8n-workflows/db-gpt-query.json). POST {question, db_name} โ returns {answer, sql, data}.
Full Guide
โ chinese-ai-tools-english-guide
Previous articles in this series:
- 5 Chinese AI tools the West is ignoring
- WeKnora โ Tencent's RAG framework
- MaxKB โ simplest self-hosted RAG
Your data never leaves your machine. No API keys, no cloud, no SQL knowledge needed.













