Skip to main content

NeuroSQL: Neural-powered Text-to-SQL generator.

Project description

NeuroSQL

NeuroSQL is an advanced neural Text-to-SQL generator based on T5/Transformers.
Convert natural language questions and database table schemas into accurate SQL queries.


Installation

NeuroSQL is modular: you can install only the components you need.

Install for production/basic usage (core dependencies only):

pip install neurosql

Install with API support (FastAPI, uvicorn, pydantic):

pip install neurosql[api]

Install for development (includes notebooks, testing, plotting, ML utilities):

pip install neurosql[dev,api]

For exact environment reproduction (e.g., full research replication):

pip install -r requirements.txt

Quick Start

Python Example:

from neurosql import NeuroSQLModel

model = NeuroSQLModel.from_pretrained("0xV4h3/neurosql")
sql = model.generate(
    query="Show all sales in Armenia for 2020",
    context="CREATE TABLE sales(id INT, country VARCHAR(20), year INT, sales INT);"
)
print(sql)  # Example: SELECT * FROM sales WHERE country='Armenia' AND year=2020;

Command-Line Interface (CLI)

Run SQL generation in the terminal:

neurosql --query "Show sales in Armenia for 2020" --context "CREATE TABLE sales(id INT, country VARCHAR(20), year INT, sales INT);"

API

Integrate NeuroSQL into your service using the built-in FastAPI server.
See usage examples in the examples/ directory.


Notebooks & Training

Find Jupyter notebooks for fine-tuning and experimenting with the model in the notebooks/ directory.
You can further customize NeuroSQL for your own datasets and domains.


Model Card

The pretrained and fine-tuned model is available on Hugging Face:
Hugging Face Model Card


Requirements

  • Python 3.8+
  • torch >= 2.0.0
  • transformers >= 4.30.0
  • datasets >= 2.10.0
  • tqdm
  • For API: fastapi, uvicorn, pydantic
  • For development: notebook, pytest, matplotlib, scikit-learn, etc.
  • See requirements.txt for the complete development environment.

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

neurosql-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

neurosql-0.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file neurosql-0.1.1.tar.gz.

File metadata

  • Download URL: neurosql-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for neurosql-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bfb2e50b0bf52a800b8928fcddc20237521fae35f3927aa6540fdf77da890b5a
MD5 02c6ed10a31935cc9feec269fd9aac15
BLAKE2b-256 48407220af05da9ea90b7cf9e62fa0a156803abe5a7b14515345bb5a2706649d

See more details on using hashes here.

File details

Details for the file neurosql-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: neurosql-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for neurosql-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85ad1afacd698f4be35145acbabc9ffb67e90a1b244f66f65f5e4f622db97030
MD5 e035dcf22496fd4c641cf8605ea6523a
BLAKE2b-256 6dbfdfc649f0011b259d2ccb894c8fe272b43cd9e9200e24db98c55d0c42ee85

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