Skip to content

NL2SQL is a web app that lets you ask questions in plain English about your SQLite database. It automatically generates the SQL query, executes it, and displays the results — no coding or SQL knowledge required.

License

Notifications You must be signed in to change notification settings

guptakushal03/NaturalLanguage2SQLite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NaturalLanguage2SQLite

Turn plain English questions into database answers — no SQL knowledge required!


What is NL2SQL?

NL2SQL is a web application that allows users to ask questions in plain English about their SQLite databases. The app automatically:

  1. Converts your question into a SQL query.
  2. Executes the query on your database.
  3. Shows the results in an interactive table.
  4. Lets you download results as a CSV file.

Perfect for anyone who wants to query databases without writing a single line of SQL.


Key Features

  • Natural Language Queries: Ask questions like “Show top 5 students by GPA in 2023.”
  • Automatic SQL Generation: Uses AI (Google Gemini) to write SQL for you.
  • Database Schema Display: See all tables and columns in your database.
  • Raw Schema Option: For advanced users, view the database structure (DDL statements).
  • Results Table & Download: View query results and download them as CSV.
  • Automatic AI Model Selection: Uses the best available Gemini AI model automatically.

How to Use

  1. Open the app in your browser.
  2. Upload your SQLite .db file.
  3. Browse your database tables and columns (optional).
  4. Type your question in plain English.
  5. Click Generate SQL.
  6. View the generated SQL and query results.
  7. Download the results as a CSV if needed.

Supported Databases

  • Currently supports SQLite databases (.db).

Why Use NL2SQL?

  • Save time and avoid manual SQL coding.
  • Perfect for managers, analysts, or anyone who needs database insights quickly.
  • Works instantly in the browser — no installation required.

Live Demo

Try it now: https://naturallanguage2sequelite.streamlit.app


Setup (Optional – For Developers)

This section is optional for clients; mostly relevant for technical users.

  1. Clone the repository:
git clone https://github.com/guptakushal03/NaturalLanguage2SQLite.git
cd NaturalLanguage2SQLite
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure your Gemini API key: Create .streamlit/secrets.toml and add:
GEMINI_API_KEY="your_api_key_here"
  1. Run the app locally:
streamlit run app.py

Contact

Kushal Gupta

About

NL2SQL is a web app that lets you ask questions in plain English about your SQLite database. It automatically generates the SQL query, executes it, and displays the results — no coding or SQL knowledge required.

Topics

Resources

License

Stars

Watchers

Forks

Languages