Enterprise-grade AI database assistant that converts natural language into SQL queries and executes them instantly β powered by a fully local LLM.
LucidSQL AI enables users to interact with databases using plain English. It uses LangChain + Ollama + Llama 3 + Streamlit to automatically generate SQL queries and return structured results through a professional dashboard.
β‘ Runs locally π Privacy-first π Offline capable π€ AI-powered database querying
- Converts natural language β SQL automatically
- Schema-aware query generation
- Uses Llama 3 via Ollama
- Runs completely on your machine
- No OpenAI or external API calls
- Privacy-safe architecture
- Offline support after setup
- Executes generated SQL instantly
- Displays results in structured tables
- Clean enterprise-grade interface
- Dark theme adaptive styling
- Responsive layout
- Session state management
- Uses only database schema
- Prevents invalid queries
- Safe SQL execution
- Lightweight local database
- Easy setup
- Fast performance
User Question
β
Prompt Engineering
β
LangChain SQL Generator
β
Local Llama 3 (Ollama)
β
SQL Query Execution
β
Results Displayed in UI
- User enters a natural language question.
- Database schema + question sent to LLM.
- Llama 3 generates SQL query.
- SQL executes on SQLite database.
- Results displayed in Streamlit UI.
Frontend β Streamlit
AI Engine β Ollama + Llama 3 (Local)
LLM Framework β LangChain
Database β SQLite
Data Handling β Pandas
β No cloud dependency β Data never leaves your machine β Works offline β Privacy-first design β Low latency inference
LucidSQL AI runs fully offline after initial setup.
- Installing dependencies
- Installing Ollama
- First-time model download
β No internet required β Local AI inference β Local database execution
| Technology | Purpose |
|---|---|
| Python | Core development |
| Streamlit | UI framework |
| LangChain | LLM orchestration |
| Ollama | Local LLM runtime |
| Llama 3 | SQL generation model |
| SQLite | Database |
| Pandas | Data processing |
LucidSQL-AI/
β
βββ app.py
βββ project.db
βββ requirements.txt
βββ README.md
git clone https://github.com/yourusername/LucidSQL-AI.git
cd LucidSQL-AIpython -m venv venvWindows
venv\Scripts\activateMac/Linux
source venv/bin/activatepip install -r requirements.txtOr manually:
pip install streamlit pandas langchain langchain-community langchain-ollamaDownload from:
π https://ollama.com
Verify installation:
ollama --versionollama run llama3After this step β fully offline usage.
streamlit run app.pyOpen in browser:
http://localhost:8501
Try asking:
- Show all students with grade A
- Average score by subject
- Top 5 highest scoring students
- Count students per subject
- List students with score above 80
- AI-powered data exploration
- Business intelligence dashboards
- SQL learning tools
- Database assistants
- Analytics systems
- Enterprise internal tools
- Schema-restricted SQL generation
- Safe result handling
- No direct user SQL execution
- Local data processing
- Chat-style conversational interface
- Automatic data visualization
- Multi-database support (MySQL/PostgreSQL)
- Query explanation feature
- SQL optimization suggestions
- Query history tracking
- Authentication system
- Cloud deployment
Upayan Chatterjee AI & Data Systems Enthusiast β’ Full Stack Developer
Contributions are welcome!
- Fork repository
- Create feature branch
- Commit changes
- Open pull request

