Skip to main content

A CLI tool to generate SQL project boilerplate

Project description

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:

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

Installation

pip install genshot_sql

Example Usage

from genshot_sql import chat

chat()

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genshot_sql_pranav-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genshot_sql_pranav-0.1.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file genshot_sql_pranav-0.1.2.tar.gz.

File metadata

  • Download URL: genshot_sql_pranav-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for genshot_sql_pranav-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9473e280eb7a1764b333d4650feb8e4727f2169bc52d1363caf6173058bc2e87
MD5 4547236fc2d7b801a412b49f0807a843
BLAKE2b-256 2b94c53eb4ce6da5572e3e66fa83b5b3e294d09ba87efa56ccf7324a04c1251d

See more details on using hashes here.

File details

Details for the file genshot_sql_pranav-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for genshot_sql_pranav-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf1547b1eb529eebbde3b208741a2054f15967cc32d865f54a5b3b7a809d72b
MD5 d53f095a5ffcce3de2978da9164120ce
BLAKE2b-256 b3c9e548e222480060c40be88834bdd0859ccaac95157b2edbf7754bfefb7e0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page