A powerful Natural Language to SQL platform powered by Google Gemini AI
- Visit: https://makersuite.google.com/app/apikey
- Sign in with Google
- Click "Create API Key"
- Copy the key
Create a .env file:
cp env_template.txt .envEdit .env and paste your API key:
GEMINI_API_KEY=your_actual_api_key_here
Easy way:
chmod +x start_server.sh
./start_server.shManual way:
pip3 install -r requirements.txt
python3 backend/app.pyThen open index.html in your browser!
NLP/
├── 📄 START_HERE.md ← You are here!
├── 📘 SETUP_GUIDE.md ← Detailed setup & troubleshooting
├── 📘 README.md ← Full documentation
│
├── 🌐 index.html ← Frontend interface (open this!)
├── 🚀 start_server.sh ← Easy startup script
│
├── backend/
│ ├── app.py ← Flask API server (Gemini integration)
│ ├── schema_context.txt ← Database schema for AI
│ └── example_queries.txt ← Example SQL patterns
│
├── 📋 requirements.txt ← Python dependencies
├── 🔧 env_template.txt ← Environment variables template
└── .gitignore ← Git ignore rules
Examples:
- "Show all farmers by partner"
- "List kyaris created last month"
- "Get farms with missing documents"
- "Show species distribution by district"
The AI will:
- ✅ Understand your request
- ✅ Generate proper SQL
- ✅ Execute it safely
- ✅ Display beautiful results
- 📊 View results in a table
- 📥 Export as CSV or JSON
- 📋 Copy the generated SQL
- 🔄 Refine and re-run
- Knows your complete database schema
- Understands relationships between tables
- Learns from example queries
- Generates optimized SQL
- Read-only queries - No data modification possible
- SQL validation - Blocks dangerous operations
- Read-only user - Database-level protection
- Input sanitization - SQL injection protection
- Fast query execution
- Beautiful, responsive UI
- Error handling & validation
- Performance metrics
- Export functionality
Show me documentation status by partner organization
List all kyaris with species information created in the last 30 days
Get all farmers in Punjab state with their farm details
Find farms with missing land records grouped by district
Show primary and secondary species distribution across all plantations
Get kyari creation trends by month for 2025
Already configured for your read-only replica:
- Host:
farmer-read-replica.crqfrvul5g3i.ap-south-1.rds.amazonaws.com - Database:
production - User:
readonly
- Backend:
http://localhost:5000 - Frontend: Open
index.htmlin browser - Model: Gemini 1.5 Pro
→ Add your API key to .env file
→ Check internet connection and database access
→ Kill existing process: lsof -ti:5000 | xargs kill -9
→ Run: pip3 install --upgrade -r requirements.txt
For more help, see SETUP_GUIDE.md
- ✅ Farmers & Farms
- ✅ Kyaris (Plantation Plots)
- ✅ Species & Plantation Models
- ✅ Documentation Status
- ✅ Countries, States, Districts
- ✅ Blocks & Villages
- ✅ Geographic coordinates
- ✅ Biochar Production
- ✅ AWD (Water Management)
- ✅ Carbon Quantification
- ✅ Survey Details
- ✅ Documentation compliance
- ✅ Plantation progress
- ✅ Species distribution
- ✅ Partner performance
-
Be Specific: "Farmers in Punjab created last month" > "Show farmers"
-
Use Filters: Include date ranges, partners, locations, statuses
-
Check SQL: Review generated SQL to understand the query
-
Iterate: Refine your query if results aren't perfect
-
Use Examples: Click example cards to see patterns
- ✅ Start the server
- ✅ Open index.html
- ✅ Try an example query
- ✅ Explore your data!
- Setup Issues: See SETUP_GUIDE.md
- Usage Help: See README.md
- Console Errors: Check browser DevTools (F12)
- Server Errors: Check terminal output
Your non-technical team can now query the database using plain English!
Just open index.html and start exploring your data. No SQL knowledge required! 🚀
Made with ❤️ using Google Gemini AI