An AI-powered assistant that converts natural language queries to SQL using Google Gemini + LangGraph.
sql-assistance-frontend/: UI built with HTML, CSS, JSsql-assistance-backend/: Python backend using LangGraph, SQLAlchemy, Google Gemini
cd sql_agent_-backend
pip install -r requirements.txtLocated in
sql_agent_backend
- Python 3.8+
- PostgreSQL (with an existing database)
- Google AI Key (for Gemini)
psycopg2andlangchaindependencies
cd sql_agent_backend
python -m venv venv
source venv/bin/activate # For Windows: venv\Scripts\activate
pip install -r requirements.txt- 📁 Environment Variables Create a .env file in the project root You can use .env.example as a template
cp .env.example .env- 🚀 Run Frontend Simply open the HTML file in your browser: open index.html
Then from sql_agent_backend:
python sql_agent.pyThis will:
Load schema from PostgreSQL
Run LangGraph to interpret user prompts
Generate & validate SQL
Execute and return results