Skip to content

kartikrupal/project_sql_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gemini-Powered SQL Code Generator This project is a simple yet powerful web application that leverages the Google Gemini API to translate natural language descriptions into SQL queries. It provides a user-friendly interface for generating complex database queries without needing to write the SQL code manually.

✨ Features Natural Language to SQL: Effortlessly generate SQL queries by typing what you need in plain English.

Gemini API Integration: Utilizes the advanced capabilities of the Gemini model for accurate and context-aware code generation.

Easy-to-Use Web Interface: A straightforward web page for entering prompts and viewing the generated SQL code.

Secure API Key Management: Uses a .env file to securely store your API key, keeping it separate from your codebase.

βš™οΈ Prerequisites Before you get started, ensure you have the following installed on your machine:

Python 3.7+: Download the latest version from python.org.

pip: Python's package installer, which comes with Python.

Gemini API Key: An active API key from Google AI Studio. You can create one for free here.

πŸš€ Installation & Setup Follow these steps to set up and run the project locally.

Clone the Repository

If you are using Git, clone the project to your local machine.

Bash

git clone https://github.com/your-username/your-project.git cd your-project Alternatively, if you received a .zip file, extract all contents into a new folder and navigate into it using your terminal.

Install all the required Python libraries

Configure Your API Key

Create a file named .env in the root directory of your project. Open it with a text editor and add your Gemini API key in the following format:

GEMINI_API_KEY="YOUR_API_KEY_HERE" Replace "YOUR_API_KEY_HERE" with the actual key you obtained from Google AI Studio.

▢️ Usage Once the setup is complete, you can run the application.

Start the Application

From your terminal, with the virtual environment active, run the main Python script.

Bash

python app.py Access the Web Interface

The application will start a local web server. Open your web browser and navigate to the following address:

http://127.0.0.1:5000 Generate SQL

On the web page, enter your natural language request in the input box (e.g., "select all users from the users table where their age is greater than 30").

Click the "Generate SQL" button.

The generated SQL code will appear in the output box below.

πŸ“ Project Structure This is a typical structure for a web application using a framework like Flask.

/your-project β”œβ”€β”€ app.py # The main application script β”œβ”€β”€ backend/ # Likely contains additional Python modules or logic β”œβ”€β”€ static/ # Contains static assets like CSS, JavaScript, and images β”œβ”€β”€ templates/ # Contains HTML template files for the web interface β”‚ └── index.html β”œβ”€β”€ .env # Your API key configuration file (user-created) β”œβ”€β”€ .gitignore # Tells git which files to ignore └── requirements.txt # List of Python dependencies

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published