Convert user natural language queries into SQL statements based on provided DDL using Gemini and Streamlit.
This project allows users to input queries in natural language and convert them into SQL queries based on a given database schema (DDL). It leverages the power of Gemini for natural language processing and Streamlit for creating an interactive web application.
- Natural Language Processing: Translates user-friendly queries into SQL.
- Custom DDL Input: Users can provide their own database schema for accurate SQL generation.
- Interactive Interface: Built with Streamlit for ease of use.
- Real-Time Conversion: Instantaneous SQL query generation upon input.
- Python 3.7 or higher
- pip package manager
- Clone the Repository
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name
pip install -r requirements.txt
- Go to Google AI Studio and generate new Key
- Create
.streamlit/secrets.toml
file in the root of your project - Paste
GOOGLE_API_KEY = "your-api-key"
streamlit run app.py
- Paste your database schema (DDL) into the provided text area or
- Chose from templates Example:
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
department VARCHAR(50),
salary DECIMAL(10,2)
);
- Type your query in the input box. Example:
List all employees in the Sales department earning more than $50,000.