Turn your words into SQL magic Visualize your data dynamically Multi-database support
🎯 Core Features
- Natural Language to SQL 🗣️ → 📝
- Convert text queries into SQL commands using Google's Gemini Pro model
- Intelligent query interpretation with detailed decision logs
- Step-by-step reasoning for query generation
- Multi-Database Support 🗄️
- SQLite compatibility with file upload
- PostgreSQL integration with secure connection
- Dynamic schema exploration
- Interactive Data Explorer 🔍
- Real-time data filtering and exploration
- Comprehensive query results with summary statistics
- Advanced table views with sorting and filtering
📊 Visualization & Analytics
- Dynamic Visualizations 📈
- Multiple chart types (Bar, Line, Scatter, Area, Histogram)
- Interactive chart configuration
- AI-powered visualization recommendations
- Summary Statistics 📋
- Detailed numeric analysis
- Categorical data insights
- Distribution analysis
- Statistical measures (mean, median, mode, skewness, kurtosis)
🛡️ Security & Management
- Safe SQL Execution 🔒
- Strict query validation
- SQL injection prevention
- Comprehensive error handling and feedback
- Query History 📚
- Searchable query log
- Query reusability
- Multiple export formats (CSV, Excel, JSON)
graph LR
A[User Input] --> B[Gemini Pro]
B --> C[SQL Generator]
C --> D[Database]
D --> E[Results]
E --> F[Visualization]
1️⃣ Clone the Repository
git clone https://github.com/yourusername/NLP2SQL.git
cd NLP2SQL
2️⃣ Set Up Environment
# Create .env file
cat << EOF > .env
GEMINI_API_KEY = "Your Google Gemini API Key"
GEMINI_MODEL = "Name of Gemini Model You Will be usin"
EOF
3️⃣ Install Dependencies
pip install -r requirements.txt
4️⃣ Launch the App
streamlit run app/NLP2SQL.py
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
- Query Input ➡️ User enters natural language query
- Processing ➡️ Gemini Pro 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
- 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
- Strict SQL query validation
- Prevention of harmful SQL operations
- Secure database connections
- Protected sensitive information
- Input sanitization
- Comprehensive summary statistics
- Distribution analysis
- Correlation detection
- Trend identification
- Outlier detection
MIT License © Lohit Kolluri - feel free to use this project as you wish!