How lohitkolluri/nlp2sql works
NLP2SQL is a Streamlit application that turns natural-language questions into SQL, runs queries against SQLite or PostgreSQL, and presents analysis and visualizations. The README documents validation, decision logs, multimodal input, query history, and exports; these are included as product capabilities, though their implementation details are not all visible in the excerpts. The main app excerpt is partial, so some workflow links rely on the README rather than inspected call sites.
Main entry points: NLP2SQL.py SQL generation · DB_Config.py Query execution · LLM_Config.py Provider routing · Base_Prompt.py SQL prompt
Components 17
User interface
- Streamlit application
app/NLP2SQL.py - Text and image input
app/NLP2SQL.py - Query history and export
app/NLP2SQL.py
Query generation
- SQL prompt
src/prompts/Base_Prompt.py - SQL generation
app/NLP2SQL.py - Provider routing
src/api/LLM_Config.py - SQL validation
app/NLP2SQL.py
Database access
- Schema discovery
src/database/DB_Config.py - Query execution
src/database/DB_Config.py
Results and analysis
- Result display
app/NLP2SQL.py - Summary statistics
app/NLP2SQL.py - Charts and analysis
app/NLP2SQL.py - Decision log
app/NLP2SQL.py
Other components
- User
- Azure OpenAI
- Gemini
- Selected database
Connections 17
- User → Streamlit application: uses
README.md - Streamlit application → Text and image input: offers
README.md - Text and image input → SQL generation: submits question
README.md - SQL generation → SQL prompt: builds prompt
src/prompts/Base_Prompt.py - SQL prompt → Schema discovery: retrieves schema
src/prompts/Base_Prompt.py - SQL generation → Provider routing: requests completion
app/NLP2SQL.py - Provider routing → Azure OpenAI: routes requests
src/api/LLM_Config.py - Provider routing → Gemini: routes requests
src/api/LLM_Config.py - SQL generation → SQL validation: validates SQL
app/NLP2SQL.py - SQL validation → Query execution: permits query
app/NLP2SQL.py - Streamlit application → Query execution: runs query
README.md - Query execution → Selected database: queries
src/database/DB_Config.py - Query execution → Result display: returns rows
README.md - Result display → Summary statistics: summarizes
README.md - Result display → Charts and analysis: renders charts
README.md - SQL generation → Decision log: produces reasoning
README.md - Streamlit application → Query history and export: manages queries
README.md