This is a lightweight, open-source demo that lets you ask natural language questions and get SQL queries in return — powered by Vanna.AI, OpenAI GPT, and a simple Flask UI.
Ask questions like:
- "Show all categories of sales"
- "List top-selling categories by revenue"
- "Get total orders per region"
✅ Natural language → SQL conversion
✅ Connects to a real SQLite database
✅ Powered by OpenAI GPT-4 + ChromaDB
✅ Flask-based interactive web interface
✅ Environment-based API key loading with .env
✅ Easily extensible to Postgres, MySQL, BigQuery, etc.
Vanna-Demo/
├── .env # Your OpenAI API key (secure, ignored by Git)
├── db.py # DB config for SQLite
├── demo_sales.db # Sample SQLite database
├── main.py # CLI + Flask app entry point
├── vanna_setup.py # Vanna LLM setup and training
├── requirements.txt # Python dependencies
└── readme.md # This file
git clone https://github.com/your-username/Vanna-Demo.git
cd Vanna-Demopip install -r requirements.txtCreate a .env file in the root directory with your OpenAI API key:
OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXTo run the app and open the Flask UI:
python main.pyVisit your browser at: http://127.0.0.1:5000
- "Show all customers who ordered more than once"
- "List total sales by region"
- "Find the average order value"
- Loads table definitions from SQLite using introspection.
- Trains the Vanna model with DDL, sample SQL, and documentation.
- Accepts natural language questions via CLI or Flask UI.
- Converts questions into SQL using OpenAI and your schema context.
- Add support for more databases (Postgres, MySQL, Snowflake, etc.)
- Enhance Flask UI with chat history or result charts
- Deploy to Docker or cloud
Created by [Pradeep Kumar]
Powered by Vanna.AI
MIT License