An AI-powered Data Analyst Assistant that converts natural language questions into SQL queries and generates real-time insights from CSV/Excel datasets.
Instead of manually writing SQL queries, users can simply ask business questions in plain English and the assistant automatically:
- Generates SQL queries
- Executes them on structured data
- Displays results instantly
- Creates automatic visualizations
✅ Upload CSV or Excel datasets
✅ Ask business questions in plain English
✅ Automatic SQL query generation
✅ SQLite in-memory execution
✅ Real-time data visualization
✅ Local LLM integration (Ollama – gemma3)
✅ No cloud API required
User Question
→ LLM converts question to SQL
→ SQLite executes SQL
→ Streamlit displays results
→ Automatic visualization generated
This completely removes the need for manual SQL writing.
- Top 5 customers by sales
- Total revenue by month
- Average order value
- Sales by region
- Monthly growth trend
| Layer | Technology |
|---|---|
| UI | Streamlit |
| Data Processing | Pandas |
| Database | SQLite (In-Memory) |
| LLM | Ollama (gemma3 local model) |
| Visualization | Streamlit Charts |
git clone https://github.com/YOUR_USERNAME/LLM-Data-Analyst-Assistant.git
cd LLM-Data-Analyst-Assistant
2️⃣ Install Dependencies
pip install streamlit pandas openpyxl requests3️⃣ Install Ollama (Local LLM)
Download from:
https://ollama.com/downloadMake sure Ollama Desktop is running.
4️⃣ Ensure Model is Available
Use an installed model such as:
gemma3:4bCheck available models:
Invoke-RestMethod http://localhost:11434/api/tags5️⃣ Run the App
streamlit run app.pyOpen in browser:
http://localhost:8501📊 Example Use Case
👨💼 Business Manager asks:
Which customer generated the highest revenue this quarter?
The Assistant:
- Converts question into SQL
- Aggregates data
- Sorts by revenue
- Returns top customer instantly
- Displays a visualization
🎯 Why This Project?
-
This project demonstrates:
-
LLM + SQL integration
-
Local AI deployment (No OpenAI API required)
-
Real-time analytics
-
Business intelligence automation
-
Practical AI application for decision-making