/SQL-query-builder

Primary LanguageHTMLMIT LicenseMIT

EasyQuery - AI SQL Query Builder

EasyQuery is an advanced AI-powered SQL Query Builder designed to transform human language instructions into precise SQL queries. This tool is particularly valuable for users with limited SQL knowledge, making it easy to interact with databases using simple, natural language commands. By leveraging natural language processing (NLP) and artificial intelligence (AI), EasyQuery interprets user inputs, understands data structures, and generates the appropriate SQL queries.

Note: This is a hackathon project, and is meant to be a proof of concept. While functional, it is not yet production-ready. And some functionalities like updating ddl, etc. are missing and are hardcoded. If you wish to use it, and don't understand something, feel free to mail me at baxidhairya2312@gmail.com

Table of Contents

  1. Features
  2. Project Structure
  3. Installation
  4. Usage
  5. Configuration
  6. Contributing
  7. License

Features

  • Natural Language Processing: Converts user-friendly natural language inputs into SQL queries.
  • AI-Driven: Uses advanced AI algorithms to understand and generate queries.
  • Easy to Use: Designed for users with minimal SQL knowledge.
  • Web-Based Interface: Interact with the tool through a simple and intuitive web interface.
  • Cross-Platform: Works on any platform with Python and Node.js environments.

Project Structure

EasyQuery/
├── index.js
├── package.json
├── package-lock.json
├── public/
│   ├── icon.png
│   ├── index.html
│   ├── script.js
│   ├── send.webp
│   ├── set-ddl/
│   │   └── index.html
│   ├── styles.css
│   └── usericon.png
├── __pycache__/
│   └── code.cpython-310.pyc
└── server-chatbot.py
  • index.js: The main entry point for the Node.js server.
  • package.json: Contains metadata about the Node.js project and its dependencies.
  • package-lock.json: Describes the exact dependency tree generated by npm.
  • public/: Contains static assets for the web interface.
    • icon.png: Icon used in the web interface.
    • index.html: The main HTML file for the user interface.
    • script.js: JavaScript file for client-side functionality.
    • send.webp: An image asset.
    • set-ddl/index.html: HTML for the set DDL interface.
    • styles.css: CSS file for styling the web interface.
    • usericon.png: User icon image.
  • pycache/: Compiled Python files for faster execution.
  • server-chatbot.py: The main Python script running the Flask server and AI model.

Installation

Prerequisites

  • Python: Ensure Python is installed. Python 3.10 or higher is recommended.
  • Node.js: Ensure Node.js and npm are installed.

Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/EasyQuery.git
    cd EasyQuery
  2. Install Python dependencies: Create a virtual environment and activate it:

    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`

    Install the required packages:

    pip install -r requirements.txt
  3. Install Node.js dependencies:

    npm install

Usage

  1. Start the Flask Server: Open a terminal and navigate to the project directory. Run the following command to start the Python server:

    python server-chatbot.py
  2. Start the Node.js Server: In another terminal window, navigate to the project directory and run:

    node index.js
  3. Access the Web Interface: Open your web browser and navigate to http://localhost:3000 to interact with EasyQuery.

Configuration

Update the Llama model path in server-chatbot.py:

# Initialize Llama model
llm = Llama(model_path="your_model_path/mistral-7b.gguf")

Replace "your_model_path/mistral-7b.gguf" with the path to your Llama model.

Contributing

We welcome contributions! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and commit them.
  4. Push your changes to your fork.
  5. Submit a pull request to the main repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Happy Querying with EasyQuery!