Convert natural language questions to SQL queries using Google's Generative AI! 🤖

Text-2-SQL-v3/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── static/
│ ├── css/ # Stylesheets
│ └── js/ # JavaScript files
├── templates/
│ ├── base.html # Base template
│ └── index.html # Main application page
├── uploads/ # Temporary CSV storage
└── model_cache/ # Cached model files
- 📊 Upload and analyze CSV files
- 💬 Natural language to SQL conversion using Google's Generative AI
- 📈 Automatic data visualization
- 📑 Statistical summaries
- 🎯 Interactive query examples
- 📱 Responsive design
- Python 3.8 or higher
- pip (Python package manager)
- Git
- Google API key for Generative AI
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Generative Language API
- Create credentials (API key) for the Generative Language API
- Copy your API key
- Add it to the
.envfile:GOOGLE_API_KEY=your_google_api_key_here
git clone https://github.com/yourusername/Text-2-SQL-v3.git
cd Text-2-SQL-v3# Create virtual environment
python -m venv venv
# Activate virtual environment
# For Windows
venv\Scripts\activate
# For Unix or MacOS
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtpython app.pyVisit http://localhost:5000 in your web browser 🌐
- Upload your CSV file using the upload button or drag-and-drop
- Wait for the data preview to load
- Type your question in natural language or use example queries
- Click "Generate Insights" to get SQL and results
- Explore visualizations and statistics in the results section
- Backend: Flask (Python)
- AI Model: Google Generative AI (Gemini) for text-to-SQL conversion
- Frontend: HTML5, CSS3, JavaScript
- Data Processing: Pandas, NumPy
- Visualization: Matplotlib, Seaborn
- "Show all rows from the table"
- "What is the average [column]?"
- "Find records where [column] > [value]"
- "Show the top 5 rows"
- Maximum file size: 10MB
- Supported format: CSV
- Model files are cached locally after first run
- Requires active internet connection for first-time model download
Feel free to:
- 🐛 Report bugs
- 💡 Suggest enhancements
- 🔀 Submit pull requests
This project is licensed under the MIT License - see the LICENSE file for details.
- Google for the Generative AI API
- Flask team for the web framework
- Open source community for various libraries