Transform natural language into SQL queries using Azure OpenAI. Visualize database results with interactive charts and explore data effortlessly.
Turn your words into SQL magic
Visualize your data dynamically
Multi-database support
✨ Features
🎯 Core Features
- Natural Language to SQL 🗣️ → 📝
- Multimodal Interaction 🎥
- Multi-Database Support 🗄️
- Interactive Data Explorer 🔍
📊 Visualization & Analytics
- Dynamic Visualizations 📈
- Summary Statistics 📋
🛡️ Security & Management
- Safe SQL Execution 🔒
- Query History 📚
🚀 Getting Started
graph LR
A[User Input] --> B[LLM Processing]
B --> C[SQL Generator]
C --> D[Database]
D --> E[Results]
E --> F[Visualization]
Installation
1️⃣ Clone the Repository
git clone https://github.com/lohitkolluri/NLP2SQLL.git
cd NLP2SQL
2️⃣ Set Up Environment
# Create .env file
cat << EOF > .env
2a: Azure Configuration
LLM_PROVIDER=AZURE
OPENAIENDPOINT="https://[ENDPOINTNAME].openai.azure.com"
OPENAIAPIVERSION="2024-08-01-preview"
OPENAIAPIKEY="YOUR AZURE OPENAI API KEY"
MODEL_NAME="YOUR AZURE OPENAI MODEL NAME"
2b: Gemini Configuration
LLM_PROVIDER=GEMINI
GEMINIAPIKEY="YOUR GEMINI API KEY"
EOF
3️⃣ Install Dependencies
pip install -r requirements.txt
4️⃣ Launch the App
streamlit run app/NLP2SQL.py
🎨 Built With
| Technology | Purpose | | :--------------------------------------------------------------------------------------------------: | :------------: | | | Web Interface | |
| NLP Processing | |
| NLP Processing | |
| PostgreSQL DB | |
| SQLite DB | |
| Visualizations |
🌟 Key Features
mindmap
root((NLP2SQL))
Query Processing
Natural Language Input
Decision Logging
Detailed Reasoning
Visualization
Interactive Charts
Summary Statistics
Data Distribution
Database
PostgreSQL
SQLite
Schema Analysis
Security
Query Validation
Error Handling
Safe Execution
💡 How It Works
- Query Input ➡️ User enters natural language query
- Processing ➡️ Azure OpenAI analyzes and generates SQL with reasoning
- Validation ➡️ Query is validated for safety and correctness
- Execution ➡️ Query runs against selected database
- Analysis ➡️ Results are processed with summary statistics
- Visualization ➡️ Data is presented with AI-recommended charts
- Export ➡️ Results can be downloaded in multiple formats
📊 Supported Visualizations
- Bar Chart: Comparing categorical data
- Line Chart: Time-series and trend analysis
- Scatter Plot: Relationship between variables
- Area Chart: Cumulative totals and trends
- Histogram: Distribution analysis
🔒 Security Features
- Strict SQL query validation
- Prevention of harmful SQL operations
- Secure database connections
- Protected sensitive information
- Input sanitization
📈 Data Analysis
- Comprehensive summary statistics
- Distribution analysis
- Correlation detection
- Trend identification
- Outlier detection
License © Lohit Kolluri