nl2sql-engine
The engine behind NL2SQL, for developers who embed it in Python or run it through the CLI and REST packages. The model returns a typed query plan, never SQL text; the plan is checked against the real schema and the caller's role before any SQL is generated.
This distribution holds the pipeline, the nl2sql Python facade and the database adapters (PostgreSQL, MySQL, SQL Server, SQLite, DuckDB). The nl2sql command is the separate nl2sql-cli package and the REST server and web app are nl2sql-api.
Requires Python 3.12 or newer.
Try it
Hosted demo on three sample databases, nothing to install: https://nl2sql.codewithnk.com. To run it yourself:
pip install "nl2sql-cli[web]"
nl2sql demo
Use it from Python
from nl2sql import NL2SQL, UserContext
engine = NL2SQL.demo() # the bundled databases; reads a provider key from the environment
engine.index.build() # once: builds the search index
result = engine.run_query(
"How many customers are there?",
user_context=UserContext(roles=["admin"]),
)
print(result.final_answer["summary"] if result.final_answer else result.errors)
Your own config instead: NL2SQL.from_config("nl2sql.yaml"). Database drivers are extras (pip install "nl2sql-engine[postgres]", [mysql], [mssql], [duckdb], [all]); SQLite needs none.
Security
The model returns a typed plan and never SQL; the plan is checked against the schema and the caller's role before any SQL is generated. The provider sees the question, the schema it needs and the result rows. Read the security model before pointing it at real data.
Documentation
Full documentation: https://nadeem4.github.io/nl2sql/
nl2sql-sdk, nl2sql-engine, nl2sql-api and nl2sql-cli are released together. MIT licensed.
Metadata
Release files for nl2sql-engine 0.10.0
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 |
|---|---|---|---|---|
| nl2sql_engine-0.10.0.tar.gz | 1.3 MB | Without provenance | Details for nl2sql_engine-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nl2sql_engine-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for nl2sql_engine-0.10.0-py3-none-any.whl |
Total release size: 2.7 MB
Release files / nl2sql_engine-0.10.0.tar.gz
| Download URL | nl2sql_engine-0.10.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2771c6b668e5a427641649528ceceebe23aeaec38b4dd1ee2910c53b8c4b3cb5
|
|
BLAKE2b-256 checksum How to use checksums |
0834342dfe45e7712458a8c65fc46cfd9310203af5de1c9438136e003552c531
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / nl2sql_engine-0.10.0-py3-none-any.whl
| Download URL | nl2sql_engine-0.10.0-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ad50289fd0d173f31b74d8bcb1be000b1bd74f7ffe6c4dc2c373da1092b529d
|
|
BLAKE2b-256 checksum How to use checksums |
a459132106a084125705398128daecb3beaa4c91d99357d31a68f36551dbe9b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for nl2sql-engine 0.10.0
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.