Skip to content
/ ChatDB Public

Chatbot designed to simplify interaction with your MySQL database using natural language. Instead of writing complex SQL queries, just type your questions or commands in plain English, and ChatDB seamlessly converts them into efficient SQL queries.

Notifications You must be signed in to change notification settings

Ashp116/ChatDB

Repository files navigation

ChatDB

ChatDB is an open-source chatbot that lets you interact with your MySQL database using natural language.

Simply type your database inquiries in plain English, and ChatDB translates them into efficient SQL queries to retrieve and manipulate data seamlessly.

Demo

ChatDB-demo.mp4

Info

  • Natural Language to SQL
    Converts plain English queries into optimized MySQL commands using the powerful T5-LM-Large-text2sql-spider model by GaussAlgo. This transformer-based model is fine-tuned specifically for text-to-SQL generation on the Spider dataset, enabling accurate and complex query generation.

  • Smart Input Classification
    Uses a binary classifier to distinguish database queries from unrelated input, improving accuracy and user experience.

  • Robust Database Connectivity
    Works with any MySQL database, enabling dynamic data retrieval and updates.

  • Multiple Interfaces
    Provides both a Command-Line Interface (CLI) and a web-based UI for flexible usage.

Architecture

%%{init: {"themeVariables": {"primaryColor": "#FF6F61", "secondaryColor": "#6B5B95", "tertiaryColor": "#88B04B", "lineColor": "#333", "textColor": "#fff", "fontSize": "16px"}}}%%
flowchart LR
    A([User Input]) --> B([Input Classifier])
    B -->|DB Query| C([Query Interpreter])
    B -->|Not DB Query| D([Reject or Respond])
    C --> E([Generate SQL])
    E --> F([Execute on MySQL])
    F --> G([Return Results])
    G --> H([Display to User])
Loading

Getting Started

Prerequisites

  • Python 3.8+
  • Access to a MySQL database instance

Installation

git clone https://github.com/Ashp116/ChatDB.git
cd chatdb
pip install -r requirements.txt
cp .env.example .env
# Update .env with your MySQL credentials
python main.py

Usage

  • Start the server or CLI application

  • Enter natural language queries like:

    • "Show me all the users"
    • "Get me the user in users who has the name Ash"
    • "Show me all the inventory items"
  • View formatted results instantly without writing SQL!

About

Chatbot designed to simplify interaction with your MySQL database using natural language. Instead of writing complex SQL queries, just type your questions or commands in plain English, and ChatDB seamlessly converts them into efficient SQL queries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published