PortfolioNatural Language to SQL Query Interface

Natural Language to SQL Query Interface

Personal Project

TL;DR - Quick Summary

Built a chat interface that converts natural language to SQL using GPT-4o, validates queries with SQLGlot, executes them safely against a Postgres database with e-commerce data, and displays results with automatic chart generation. Users can ask "Show me top selling products" and get SQL + results + visualization.

FastAPISQLGlotReactTailwind CSSPostgreSQL (with sample e-commerce schema)Dockerdocker-compose
Team:Solo project
Role:Full-Stack Developer
Status:In Development
View Project
Come back in some time to see the results! 🚀

The Problem

Business analysts and stakeholders often need to query databases for insights but lack SQL knowledge. Waiting for data engineers to write queries creates bottlenecks. Existing BI tools require learning complex interfaces and pre-defined dashboards don't answer ad-hoc questions.

The Solution

Built a simple web application with a chat interface where users type questions in plain English (e.g., "What are my top 5 customers by revenue?"). GPT-4o converts this to SQL, SQLGlot validates it for safety, the query runs against a Postgres database with sample e-commerce data, and results are displayed in both table and chart format.

Business Impact

Reduced time for business analysts to get insights from 30 minutes (request → data engineer → results) to under 5 seconds

Demonstrated practical application of LLMs for data democratization

Created reusable pattern that could be adapted to any Postgres database by updating schema in prompt