nl2sql-sdk
The interfaces an extension for the
nl2sql engine implements: database
adapters, secret providers, stores and policy checks. The import package is
nl2sql_sdk. Its core depends
on pydantic and the standard library only, so an extension built against it
inherits nothing else.
DatasourceAdapter:capabilities(),test_connection(),fetch_schema_snapshot(scope),execute(request)andget_dialect(), which returns a sqlglot dialect name such aspostgresortsql. An adapter class also declaresinterface_version = 2, aconnection_model, thedriver_modulesit needs and aninstall_hintfor when one is missing.nl2sql_sdk.sqlalchemy(pip install "nl2sql-sdk[sqlalchemy]"):SQLAlchemyAdapter, the base the built-in adapters are built on, andSQLAlchemyConnection. The one part of the SDK that imports SQLAlchemy.nl2sql_sdk.testing(pip install "nl2sql-sdk[testing]"):AdapterConformance, the conformance kit, a pytest test class an adapter's tests subclass. It imports pytest and sqlglot.AdapterRequest,ResultFrameandResultError: what the engine sends an adapter and what it gets back.SchemaSnapshotand the table, column and foreign-key contracts an adapter describes its schema with.SecretProvider:interface_version = 1, a strictconfig_modelfor its block in the secrets config,from_config(cfg)andget_secret(key).nl2sql_sdk.stores: the index, state, trace and results store interfaces.nl2sql_sdk.policy:PolicyCheck(interface_version = 1, a strictconfig_model,from_config(cfg)andgrant(user, datasource_id)), withUserContextandGrant.
An adapter is published as an nl2sql.adapters entry point, and the engine
finds it there; it never imports an adapter by name.
pip install nl2sql-sdk
Writing an adapter: Adapter development. Try the engine without installing anything: https://nl2sql.codewithnk.com.
Metadata
Release files for nl2sql-sdk 0.6.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 | |
|---|---|---|---|
| nl2sql_sdk-0.6.0.tar.gz | 29.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nl2sql_sdk-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.9 kB
Release files / nl2sql_sdk-0.6.0.tar.gz
| Download URL | nl2sql_sdk-0.6.0.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ccecafa8f1e00e67b2fbc6b9b6a94fa0190a3f2f4ad36858cdb81f8b8628a9c
|
|
BLAKE2b-256 checksum How to use checksums |
ed58c2867105d00d90ea8e688255cddd01f7bd8f2fa66517c99c0ae1463f7227
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / nl2sql_sdk-0.6.0-py3-none-any.whl
| Download URL | nl2sql_sdk-0.6.0-py3-none-any.whl |
|---|---|
| Size | 33.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2791740ff7e1bea58898d06ba5290080b053f6d390bee2daad15dead283be8fa
|
|
BLAKE2b-256 checksum How to use checksums |
5cd7a50ca272469f59ee1d010c636b7a2a93c84c8f0e8fba9c4d8557342783d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|