Welcome to Ask Your Database! This project comprises two powerful components designed to simplify database querying and SQL generation through natural language interaction.
Our project aims to revolutionize the way you interact with your MySQL or PostgreSQL databases by leveraging the power of AI. It includes two main components:
-
Chat with Database: An interactive chat application that allows you to query your localhost MySQL or PostgreSQL database using natural language. This component translates your questions into SQL queries, executes them, and returns the results in an easy-to-understand format.
-
Text to SQL Translator: A tool that accepts English prompts and returns the corresponding SQL queries. This component is ideal for users who need to generate SQL queries without writing them manually.
- Natural Language Processing: Convert plain English questions into SQL queries.
- Interactive Chat Interface: Easy-to-use chat interface for querying databases.
- Real-time Query Execution: Execute queries on your MySQL or PostgreSQL database and get instant results.
- SQL Generation: Generate SQL queries from English prompts.
Follow these instructions to set up and run the project on your local machine.
- Python 3.x
- MySQL Server
- PostgreSQL Server
- Required Python packages (listed in
requirements.txt
)
-
Clone the repository:
git clone https://github.com/BhardwajArjit/Ask-Your-Database.git cd Ask-Your-Database
-
Install the required Python packages:
pip install -r requirements.txt
-
Set up your environment variables. Create a
.env
file in the root directory and add your Google API key:GOOGLE_API_KEY=your_google_api_key
-
Run the application:
streamlit run Homepage.py
- Launch the Application: Open your browser and navigate to the Streamlit app (usually
http://localhost:8501
). - Connect to Your Database: Use the sidebar to enter your MySQL or PostgreSQL database connection details and click "Connect".
- Ask Questions: Type your questions in the chat input at the bottom of the page.
Homepage.py
: The main application file.requirements.txt
: Lists the required Python packages..env
: Environment variables for sensitive information like API keys.
If you'd like to contribute to the project, feel free to fork the repository and submit a pull request. We welcome all contributions that improve the functionality and user experience of the application.
This project is licensed under the MIT License. See the LICENSE file for details.
This application uses the following technologies: