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
- Provide your database schema.
- The schema is embedded and indexed using FAISS.
- Ask questions in plain English.
- The AI retrieves the most relevant schema context.
- The LLM generates SQL.
- The query is executed on MySQL.
- Results are returned to the user.
Installation
pip install genshot-sql-pranav
Dependencies
Install the required Python packages:
pip install faiss-cpu mysql-connector-python numpy
Ollama Requirements
Install Ollama and pull the required model:
ollama pull llama3.2:3b
You will also need an embedding model:
ollama pull nomic-embed-text
Quick Start
-
Install the library.
-
Install all the dependencies.
-
Install Ollama and pull the
llama3.2:3bmodel. -
Insert your database configuration and schema in
config.py. -
Run
chat_with_database.py.
python chat_with_database.py
Example conversation:
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
Metadata
Release files for genshot-sql-pranav 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| genshot_sql_pranav-0.1.4.tar.gz | 6.5 kB | Without provenance | Details for genshot_sql_pranav-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| genshot_sql_pranav-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for genshot_sql_pranav-0.1.4-py3-none-any.whl |
Total release size: 13.6 kB
Security for genshot-sql-pranav 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.