raedmajid/schema-aware-ai-sql-agent
This project enables users to **generate SQL queries from natural language** using **LLM** of their choice while enforcing **Role-Based Access Control (RBAC)** and **Row-Level Security (RLS)**. It also includes **SQL injection detection** and **sensitive data logging** for compliance and security.
Built on LangChain with FastAPI and Streamlit, it delivers schema-aware query generation through a memory-aware chat agent that maintains conversation context while validating queries against database schemas. The architecture chains LLM inference with parameterized query execution and enforces access control through RBAC/RLS filters applied before results return to users. Supports multiple LLM backends (OpenAI, OpenRouter, Ollama) and includes a sample Northwind PostgreSQL database for immediate testing.
No commits in the last 6 months.
Stars
5
Forks
—
Language
Python
License
MIT
Category
Last pushed
Aug 12, 2025
Commits (30d)
0
Get this data via API
curl "https://pt-edge.onrender.com/api/v1/quality/prompt-engineering/raedmajid/schema-aware-ai-sql-agent"
Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.
Higher-rated alternatives
AmmarAhm3d/automated-sql-generation-openai
Developed a Python program that can automatically generate and optimize SQL queries based on...
amitgunjal/querion-ai
Schema-aware NL2SQL assistant for PostgreSQL with SSE streaming, query reuse, feedback scoring,...
TheQuantScientist/TextToSQL
SLMs for domain-related Text-to-SQL tasks
NikolaPantel/SQL-Analyst-AI
LLM-powered analytics engine that translates natural-language questions into safe SQL and clear...
Club-Innovate/GenAI-SQL-CLI
GenAI-SQL is a modular, extensible suite of AI-powered tools for automating SQL code...