Metadata-Version: 2.4
Name: genshot_sql_pranav
Version: 0.1.2
Summary: A CLI tool to generate SQL project boilerplate
Author-email: Pranav Verma <quantumworld394@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Genshot SQL

## Created by Pranav Verma

Genshot SQL is an AI-powered Python library that allows you to interact with a MySQL database using natural language. Instead of writing SQL queries manually, you can ask questions in plain English and receive results directly from your database.

The library uses Retrieval-Augmented Generation (RAG), FAISS, and Ollama to understand your database schema and generate accurate SQL queries.

## Features

- Chat with your MySQL database using natural language
- Schema-aware SQL generation
- FAISS-powered semantic schema retrieval
- Local AI inference using Ollama
- Read-only query generation (SELECT queries)
- Fast and lightweight setup

## How It Works

1. Provide your database schema.
2. The schema is embedded and indexed using FAISS.
3. Ask questions in plain English.
4. The AI retrieves the most relevant schema context.
5. The LLM generates SQL.
6. The query is executed on MySQL.
7. Results are returned to the user.

## Dependencies

Install the required Python packages:

```bash
pip install faiss-cpu mysql-connector-python numpy
```

## Ollama Requirements

Install Ollama and pull the required model:

```bash
ollama pull llama3.2:3b
```

You will also need an embedding model:

```bash
ollama pull nomic-embed-text
```

## Installation

```bash
pip install genshot_sql
```

## Example Usage

```python
from genshot_sql import chat

chat()
```

Example conversation:

```text
You: Show all employees in the IT department

SQL:
SELECT e.*
FROM employee e
INNER JOIN department d
ON e.department_id = d.id
WHERE d.name = 'IT';

Result:
...
```

## Use Cases

- Internal business analytics
- Database exploration
- Rapid SQL prototyping
- Educational projects
- AI-powered database assistants

## Tech Stack

- Python
- MySQL
- FAISS
- NumPy
- Ollama
- Llama 3.2 3B
- Retrieval-Augmented Generation (RAG)

## License

MIT License
