# Vanna — Chat with Your SQL Database Using AI > AI-powered text-to-SQL. Ask questions in plain English, get accurate SQL queries and visualizations. Learns your schema. Works with any database. 23K+ stars. ## Install Save as a script file and run: ## Quick Use ```bash pip install vanna ``` ```python import vanna from vanna.openai import OpenAI_Chat from vanna.chromadb import ChromaDB_VectorStore class MyVanna(ChromaDB_VectorStore, OpenAI_Chat): def __init__(self, config=None): ChromaDB_VectorStore.__init__(self, config=config) OpenAI_Chat.__init__(self, config=config) vn = MyVanna(config={'api_key': 'sk-...', 'model': 'gpt-4o'}) vn.connect_to_postgres(host='localhost', dbname='mydb', user='postgres', password='pass') # Train on your schema vn.train(ddl="CREATE TABLE users (id INT, name TEXT, email TEXT, created_at TIMESTAMP)") # Ask questions sql = vn.generate_sql("How many users signed up this month?") print(sql) # SELECT COUNT(*) FROM users WHERE created_at >= '2026-03-01' df = vn.run_sql(sql) vn.generate_plotly(question="...", sql=sql, df=df) # Auto-visualization ``` --- ## Intro Vanna is an AI-powered text-to-SQL tool. Ask questions about your database in plain English and get accurate SQL queries, results, and auto-generated visualizations. It learns your specific schema, naming conventions, and business logic through training — getting more accurate over time. Works with PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, and more. 23,000+ GitHub stars, MIT licensed. **Best for**: Data analysts and developers who want natural language access to databases **Works with**: PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, DuckDB, any SQL database --- ## Key Features ### Agentic RAG for SQL Uses retrieval-augmented generation specifically tuned for SQL. Retrieves relevant schema, past queries, and documentation before generating SQL. ### Schema Learning Train Vanna on your DDL, sample queries, and documentation. It learns your tables, relationships, and naming patterns. ### Auto-Visualization Generates Plotly charts automatically from query results — bar charts, line graphs, pie charts, and more. ### Web UI Built-in Flask web interface for non-technical users to query databases: ```python from vanna.flask import VannaFlaskApp app = VannaFlaskApp(vn) app.run() ``` ### Multi-Database Connect to PostgreSQL, MySQL, SQLite, BigQuery, Snowflake, DuckDB, MSSQL, and any ODBC database. --- ### FAQ **Q: What is Vanna?** A: An AI text-to-SQL tool that converts natural language questions into accurate SQL queries with auto-visualization. Learns your schema over time. 23K+ stars. **Q: How accurate is the SQL generation?** A: Accuracy improves as you train Vanna on your schema and example queries. With good training data, 85-95% accuracy on typical business queries. --- ## Source & Thanks > Created by [Vanna AI](https://github.com/vanna-ai). Licensed under MIT. > [vanna-ai/vanna](https://github.com/vanna-ai/vanna) — 23,000+ GitHub stars --- Source: https://tokrepo.com/en/workflows/695f1e28-3ca1-437a-b53e-cf9bdb86bd11 Author: Script Depot