This repository contains a project that leverages OpenAI's natural language processing capabilities to convert natural language queries into SQL commands, which are then used to query a MySQL database. The goal of this project is to simplify database querying by allowing users to interact with the database using plain English, eliminating the need for extensive SQL knowledge.
- Natural Language to SQL Conversion: Utilizes OpenAI to translate user input in natural language into SQL commands.
- MySQL Database Integration: Executes the generated SQL commands on a MySQL database.
- Streamlit Interface: Provides an intuitive web interface using Streamlit for users to input their queries, view the generated SQL, and see the query results from the database.
- Dynamic Querying: Supports a wide range of SQL queries based on natural language input.
- OpenAI API: For natural language processing and SQL generation.
- MySQL: Database management system.
- Python: Core programming language for backend logic.
- Streamlit: Web framework for building the user interface.
- Clone the repository:
git clone https://github.com/zawster/AI-Driven-NL2SQL.git - Navigate to the project directory:
cd AI-Driven-NL2SQL - Install the required dependencies:
pip install -r requirements.txt - Configure the MySQL database and Openai API Key settings in
config.py. - Set the permission of the automation script:
chmod +x entrypoint.sh - Run the application:
./entrypoint.sh - Open your browser and navigate to
http://localhost:8501to use the interface.
- Enter your query in natural language in the provided text box.
- Press Enter key to complete the NL2SQL process.
- View the generated SQL command and the results from the MySQL database.
Contributions are welcome! Please create a pull request with detailed descriptions of your changes.
This project is licensed under the Apache-2.0 License.