A natural language to SQL pipeline that lets non-technical users query databases by asking questions in plain English. The system converts the question into a SQL query, executes it against the database, and translates the raw results back into a human-readable answer. No SQL knowledge required.
The pipeline handles the full round-trip: parse the user’s intent, map it to the correct tables and columns, generate valid SQL, execute it safely, then synthesize the results into a natural language response. It handles joins, aggregations, filters, and multi-step queries — the kind of work that normally requires a data analyst.
Technical Highlights
- Natural language understanding — parses intent from plain English questions
- Automated SQL generation with table/column mapping
- Safe query execution with result parsing
- Result-to-text synthesis — raw SQL output becomes readable answers
- Handles joins, aggregations, filters, and multi-step queries
Stack
- Language: Python
- AI: LLM-powered SQL generation and response synthesis
- Database: SQL query execution and schema introspection
Example
- Question: “Which products sold the most last quarter?”
- Generated SQL: SELECT product_name, SUM(quantity) FROM orders WHERE order_date >= ‘2024-10-01’ GROUP BY product_name ORDER BY SUM(quantity) DESC LIMIT 5
- Answer: “The top 5 products last quarter were Product X (450 units), Product Y (380 units)…”
