Skip to main content

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?"
dbpylot mcp         # serve as an MCP server for agent hosts (OpenPylot, Claude Desktop, …)

dbpylot mcp exposes the engine over the Model Context Protocol (stdio). Secrets can be set non-interactively for scripted setups: printf '%s' "$KEY" | dbpylot config set-key openai and dbpylot config set-db sqlite /data/app.db.

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 the dbpylot CLI (install it with cargo install opendbpylot); serve() + Settings does the same setup.

Licensed under Apache-2.0.

Metadata

Release files for opendbpylot 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opendbpylot 0.3.0
File Size Uploaded Provenance Actions
opendbpylot-0.3.0.tar.gz 2.0 MB Without provenance Details for opendbpylot-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for opendbpylot 0.3.0
File Actions
opendbpylot-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for opendbpylot-0.3.0-cp39-abi3-win_amd64.whl
opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
opendbpylot-0.3.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for opendbpylot-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
opendbpylot-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for opendbpylot-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 57.0 MB

Release files / opendbpylot-0.3.0.tar.gz

Download URL opendbpylot-0.3.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
332c6730151f99c7844c45acfb278b1073ca16c728f97d96666c6e82a13b19c0
BLAKE2b-256 checksum
How to use checksums
d0320b1db07a82a4f929008748805541d2452d46b900db4712edc8f41ab69d73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / opendbpylot-0.3.0-cp39-abi3-win_amd64.whl

Download URL opendbpylot-0.3.0-cp39-abi3-win_amd64.whl
Size 10.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
1a4842b3322ded4fd1bba772a3b1b7c43dade07fcd900b34980cb657f9fe7faa
BLAKE2b-256 checksum
How to use checksums
b9040e01971b59b7340c3e95334420abe0a8e5d0821895bad3e2b26d9b9369e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 11.5 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1b885a2100389f2958665543fca66333d543048f50d5e183a301ee2375649f14
BLAKE2b-256 checksum
How to use checksums
d2606a849041a3881bc14bab772eeee7cd249c1dada170d0b15c19d69ad0c2a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL opendbpylot-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 11.6 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2bf549ea3889d50cc2f83b215e8ffde82f863f4016095b663dc805f9e65260e1
BLAKE2b-256 checksum
How to use checksums
6a3001cf118d946d4ad013bdf0db15595919ce05c75306046b7e5cb49c117d46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / opendbpylot-0.3.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL opendbpylot-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Size 10.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
861b90d135c4744e26867ff19395a2ea81025a5331981865076e45b5c87eb80d
BLAKE2b-256 checksum
How to use checksums
893d0d336ead0094b7cc0722584e7c26f4476278863117f153252d28b8c51ad0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / opendbpylot-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL opendbpylot-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 10.9 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
37cb2147ada7ee91aa0b7e1b4f770694e58a21e0df0293557cfae496f256ff65
BLAKE2b-256 checksum
How to use checksums
1f3b7a86743b00bf0778aa2e70095e42c9256e4d3126e044345337e0694655da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for opendbpylot 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page