Skip to content

Danish08654/Text-to-SQL-Queries-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Text-to-SQL Generator enables users to interact with databases using plain English. The system translates natural language questions into executable SQL queries, validates them against the database schema, executes the query, and explains the generated SQL.


Example:

User Input


Show all employees hired after 2023.

Generated SQL

SELECT * FROM employees

WHERE hire_date > '2023-01-01';

Features

  • Natural Language → SQL conversion

  • Schema-aware query generation

  • Database connectivity and execution

  • SQL validation before execution

  • Query explanation in plain English

  • Interactive Streamlit interface

  • Support for relational databases

  • Real-time query results


Tech Stack

  • Python

  • OpenAI API

  • LangChain

  • SQLAlchemy

  • Streamlit

  • SQLite / MySQL / PostgreSQL


Use Cases

  • Business Intelligence

  • Database Analytics

  • Self-Service Data Querying

  • Enterprise Reporting

  • Data Exploration

  • SQL Learning and Education


Key Highlights

  • LLM-powered SQL generation

  • Schema-aware prompting for improved accuracy

  • Secure database interaction

  • Human-readable SQL explanations

  • End-to-end AI application deployment


Future Improvements

  • Multi-database support

  • Query optimization suggestions

  • Role-based access control

  • Query history and analytics

  • Local LLM support (Llama, Mistral, Ollama)


Author

Danish Zulfiqar


About

Convert natural language into SQL queries using Large Language Models (LLMs), schema-aware prompting, and database validation.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages