← Back to Projects

leptons1618@anishgiri.dev:~/case-studies/querypilot less writeup.md

2024 August 5, 2024 1 min read

QueryPilot

Schema-aware natural-language-to-SQL workflow with validation and explainability.

published
August 5, 2024
read
1 min
stack
6 tools
outcomes
4
media
—

01The Problem

Text-to-SQL assistants often produce unsafe or invalid queries when they lack schema context and execution safeguards.

02The Solution

Built a schema-aware generation pipeline that reads live metadata, produces SQL from user intent, validates before execution, and returns both query output and human-readable SQL explanations.

Workflow

  1. Inspect live database schema and relationships.
  2. Build constrained prompt context for query generation.
  3. Validate generated SQL before any execution step.
  4. Return results plus explanation for user verification.

Key Outcome

By combining schema grounding and a validation gate, QueryPilot balances usability with safer execution behavior.

03Achievements

  1. Reduced invalid query execution with pre-run validation checks.
  2. Improved generation quality via schema-aware prompt construction.
  3. Added SQL explanation output for trust and review workflows.
  4. Exposed end-to-end workflow through FastAPI + React interface.

04Stack

PythonFastAPISQLAlchemyPostgreSQLReactTypeScript
Private repository