Skip to main content

rubydb-python

rubydb-python is a dependency-free Python DB-API 2.0 client for RubyDB server mode. It connects over RubyDB’s newline-delimited JSON protocol and supports TLS URLs, authentication, parameterized queries, prepared statements through the wire protocol, transactions, timeouts with cancellation, and a bounded connection pool.

It does not open RubyDB embedded .rdb files. An embedded file must have one Ruby process owner; Python applications use a RubyDB server.

Install

From PyPI after release:

python -m pip install rubydb-python

From this repository during development:

cd adapters/python
python -m pip install -e .

Connect and query

import os
import rubydb

with rubydb.connect(os.environ["RUBYDB_URL"]) as connection:
    with connection.cursor() as cursor:
        cursor.execute(
            "SELECT id, name FROM users WHERE active = ? ORDER BY id",
            [True],
        )
        for row in cursor.fetchall():
            print(row)

rubydb:// is plain TCP for trusted private development networks. rubydbs:// enables TLS. Production should use rubydbs://, peer verification, a private network, and a secret manager:

rubydbs://app_user:URL_ENCODED_PASSWORD@db.internal:7432/app?verify_peer=true&ca_file=%2Fetc%2Frubydb%2Ftls%2Fca.crt

Passwords and private keys must not be committed or printed. The server and client must use compatible RubyDB protocol versions.

Transactions and pooling

Connections default to DB-API transaction behavior (autocommit=False):

import rubydb

with rubydb.connect("rubydbs://app_user:password@db.internal:7432/app") as db:
    with db.cursor() as cursor:
        cursor.execute(
            "INSERT INTO audit_events (event_name) VALUES (?)",
            ["python-start"],
        )

Prepared statements are available when the RubyDB server advertises them:

with rubydb.connect(os.environ["RUBYDB_URL"]) as db:
    statement = db.prepare("SELECT id FROM users WHERE email = ?")
    try:
        with statement.execute(["ada@example.test"]) as cursor:
            print(cursor.fetchone())
    finally:
        statement.close()

For concurrent Python workers, use a bounded pool. The pool creates at most max_size server sessions:

from rubydb import ConnectionPool

pool = ConnectionPool(
    "rubydbs://app_user:password@db.internal:7432/app",
    min_size=1,
    max_size=8,
)
try:
    with pool.connection() as db:
        with db.cursor() as cursor:
            cursor.execute("SELECT 1")
            print(cursor.fetchone())
finally:
    pool.close()

Test and package

Run the dependency-free unit tests:

cd adapters/python
python -m unittest discover -s tests -v

Build and inspect the distribution:

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*

Publish only after CI, protocol integration tests against a real RubyDB server, TLS tests, and application validation pass:

python -m twine upload dist/*

Configure PyPI credentials through trusted publishing or a protected token; never put a token in this repository or in a committed shell script.

Compatibility boundary

This is a RubyDB client, not a PostgreSQL driver. It does not provide PostgreSQL SQL compatibility, embedded-mode access, or automatic failover. Use PostgreSQL’s Python drivers for PostgreSQL applications. See the repository’s wire protocol, production operations guide, and SQL compatibility guide.

Metadata

Release files for rubydb-python 0.1.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 rubydb-python 0.1.0
File Size Uploaded Provenance Actions
rubydb_python-0.1.0.tar.gz 13.4 kB Without provenance Details for rubydb_python-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rubydb-python 0.1.0
File Interpreter ABI Platform Actions
rubydb_python-0.1.0-py3-none-any.whl Python 3 none any Details for rubydb_python-0.1.0-py3-none-any.whl

Total release size: 23.2 kB

Release files / rubydb_python-0.1.0.tar.gz

Download URL rubydb_python-0.1.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
875f852a647f9686f598dafd802709f16f70d79d356300f58b61a4c33403386b
BLAKE2b-256 checksum
How to use checksums
441774d88a360277fcfb857daee103c1d11802179f357c86a6166114018dc8eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / rubydb_python-0.1.0-py3-none-any.whl

Download URL rubydb_python-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1aa36abeded67ff70d88b4e29976a90a5deba00be90c3af2e8b15b5ba807661
BLAKE2b-256 checksum
How to use checksums
4335bc6cd6919ddfec089cdc6fec2c269ebbfd2f6dd2940f3f4e6af4712cc07c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for rubydb-python 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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