opendbpylot — natural-language → SQL via Retrieval-Augmented Generation (Python bindings)
Project description
opendbpylot (Python)
Python bindings for opendbpylot — turn a natural-language question into SQL, run it on your database, and get the results. Uses Retrieval-Augmented Generation (RAG) with a self-repairing SQL loop.
pip install opendbpylot
This installs both a Python library and a fully-working dbpylot command — the
whole CLI runs in-process from the native module, so no Rust toolchain is needed:
dbpylot init # setup wizard
dbpylot # chat with your database
dbpylot serve # web UI
dbpylot ask "how many orders per country?"
Usage (library)
First configure an LLM provider + a database. The bindings share the same config as the
dbpylot CLI (install it with cargo install opendbpylot), so run the wizard once:
dbpylot init
# …or, from Python:
python -c "import opendbpylot; opendbpylot.OpenDbPylot.init()"
Then:
import opendbpylot
bot = opendbpylot.OpenDbPylot()
result = bot.ask("how many orders per country?")
print(result["sql"]) # the generated (and self-repaired) SQL
print(result["columns"]) # column names
for row in result["rows"]: # result rows
print(row)
# Teach it about your schema / business rules:
bot.train_documentation("Revenue excludes cancelled and refunded orders.")
bot.train_question_sql("top products", "SELECT name FROM products ORDER BY price DESC LIMIT 10;")
Fully self-contained web UI
You don't even need the CLI — launch the embedded web app straight from Python and configure everything (LLM + database) in the browser Settings panel:
import opendbpylot
opendbpylot.OpenDbPylot.serve() # opens http://127.0.0.1:8080, runs until interrupted
API
OpenDbPylot()— load the engine from your saved configuration..ask(question) -> dict—{sql, columns, rows, repairs_used, answer?}..train_ddl(ddl),.train_documentation(doc),.train_question_sql(q, sql).OpenDbPylot.serve()— run the embedded web UI in-process (no CLI binary needed).OpenDbPylot.init()/.doctor()— convenience shims that call thedbpylotCLI (install it withcargo install opendbpylot);serve()+ Settings does the same setup.
Licensed under Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opendbpylot-0.1.0.tar.gz.
File metadata
- Download URL: opendbpylot-0.1.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb7937a3802978b30a7ad11d485e72ef9688eedb9b4ae2bda1abcda03ecf7e16
|
|
| MD5 |
2967e858ec96c325340a7eea3eb1042e
|
|
| BLAKE2b-256 |
33ef1ee9eedf4ab4537a8a51b60a84c44ba2ae4f2277cc988a8c87b53bf5dfe1
|
File details
Details for the file opendbpylot-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: opendbpylot-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 10.3 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6db4b54a34d7da3c34f44bf5936475de0d2f167f8cfa55b96f8a78e58f9fa78
|
|
| MD5 |
9db7d9cb19d1fb93b62fc04b06d0e58e
|
|
| BLAKE2b-256 |
6ca1cce85c335e91febff60d89e10d468f8f0ec2fdbd2bfe7dd415a8cd341a34
|
File details
Details for the file opendbpylot-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: opendbpylot-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 11.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bb6cac1892cc460acfe3d509315e8fd902c4e0cd425ff8ab10ffcfd715fd27f
|
|
| MD5 |
12e54613bb76e24714803feba1d01ba8
|
|
| BLAKE2b-256 |
79a5d08aa7a9f7af82dec74ccb7221adc42c444d7a82b1a2858e7d345ababfe9
|
File details
Details for the file opendbpylot-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: opendbpylot-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 11.3 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e430c5e32399cdd42aca479f563e1d3ec178a5c209a1619e00e768e2be7daed6
|
|
| MD5 |
897207a84cd5d57456b0f139b2093e83
|
|
| BLAKE2b-256 |
d977e13695478a074a5e28373ce05f23300ad4412874adbf7101faa04bd28ca0
|
File details
Details for the file opendbpylot-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: opendbpylot-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 10.6 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d96d30191b198218fbb172c2ad8247f189bc8230f852ca6990bbca1e9620fc2
|
|
| MD5 |
515578763aebe904044d7c8b7a38f1d4
|
|
| BLAKE2b-256 |
ae3c2d5783dfd042dc90f27ef3269d6347c1535ba9eb937eebdefac8da59b32f
|
File details
Details for the file opendbpylot-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: opendbpylot-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 10.9 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfcff75334acc71232d5fc5edef55e1bfa0037b7bef2a156592f1f4d51df93d8
|
|
| MD5 |
3f350d767bc08c13d3594c3ab04836b4
|
|
| BLAKE2b-256 |
b08bd06d15e299f38ef57abc437b627cfbc7fa9322f1a92266d0d1ff65c9435f
|