Vanna
Open-source RAG framework that turns natural language into SQL for your database.
About
Vanna is an MIT-licensed open-source Python framework for natural language to SQL. It uses retrieval-augmented generation: you train it once on your database DDL, documentation, and example queries, and it retrieves the relevant schema context for each question before generating SQL tailored to your database.
The framework supports local vector stores (ChromaDB) and any LLM backend (Ollama for fully local, OpenAI or Anthropic via API), so teams can keep database contents private: only schemas, documentation, and queries are seen by the model layer, never raw table data. It integrates into notebooks, web apps, messaging platforms, and dashboards, with streaming results, visualizations, and enterprise features like user-aware permissions and query auditing in v2.
Accuracy depends heavily on training quality: well-documented schemas with example queries perform far better than bare DDL. Setup is more involved than hosted alternatives, and complex multi-join business questions can still trip it up. A hosted tier exists (reported around $0.53/query) for teams that don't want to self-host. The open-source core remains free and is widely used in production RAG-for-SQL setups.
What it can do
- Natural language to SQL via RAG over your schema
- Training on DDL, documentation, and example queries
- Local-first option (ChromaDB + Ollama, no data leaves your infra)
- Streaming results with charts and summaries
- User-aware permissions and query auditing (v2)
- Integrations for notebooks, web apps, Slack, dashboards
Setup
pip install vanna. Choose a vector store (e.g. ChromaDB) and LLM backend (Ollama for local, OpenAI/Anthropic via API). Train once on your DDL, docs, and example queries with vn.train(). Ask questions via vn.ask() or generate_sql(); run results against your database.
Prerequisites
Python 3.8+; a vector store (ChromaDB works locally); an LLM backend (local Ollama or an API key); database credentials for query execution.
Use cases
Works with
Trust score — 8/10
Scored 8/10 (verified tier, metrics-v1). Evidence: MIT-licensed open-source NL-to-SQL framework using RAG; Local-first option (ChromaDB + Ollama) keeps data private; Well-documented on GitHub/dev.to with production usage examples; Accuracy dependence on training quality honestly disclosed.
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.