Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

BriskDB for Python

This package runs BriskDB's sharded SQLite engine in the Python process. It starts no listener by default and never installs a signal handler or global logger. A database can optionally expose its exact engine through host-controlled HTTP and PostgreSQL listeners.

Tagged releases publish compiler-free wheels for CPython 3.9–3.14 on supported macOS and Linux targets:

python -m pip install --only-binary=:all: briskdb

Document commands use PyMongo's public BSON classes as an optional companion:

python -m pip install --only-binary=:all: briskdb
python -m pip install pymongo

The BriskDB wheel does not require or import PyMongo for SQL-only applications.

To build the current checkout from source, use Python 3.9+ and Rust 1.85+:

python -m pip install ./python
import briskdb

db = briskdb.open("./data", shards=4)
session = db.session(routing_key="account-1")
session.migrate("CREATE TABLE notes (id INTEGER PRIMARY KEY, body TEXT NOT NULL)")
session.execute("INSERT INTO notes VALUES (?1, ?2)", [1, "hello"])
print(session.query("SELECT body FROM notes WHERE id = ?1", [1]))
session.close()
db.close()

Enable native BSON commands per database handle. The default standard UUID representation uses subtype 4; legacy and unspecified modes are documented in the value conversion contract.

from bson import ObjectId
import briskdb

with briskdb.open("./data", shards=4, documents=True) as db:
    with db.session() as session:
        session.create_collection("app", "notes")
        note_id = ObjectId()
        session.insert_one(
            "app", "notes", {"_id": note_id, "body": "hello"}
        )
        result = session.find("app", "notes", {"_id": note_id})
        print(result["documents"])

This first slice supports collection/index metadata, one explicit-ID insert, empty or exact-_id find/count, and exact-_id deletion through synchronous and asyncio sessions. Secondary indexes are declared as pending_build until their physical execution milestone. Broader matchers, updates, aggregation, bulk writes, and cursor continuation are still outside the Python API.

Pass shards when creating a data directory. Later calls may omit it and use the count stored in the manifest. Passing the wrong count raises FailedPreconditionError; omitting it for new/empty storage asks you to choose one without creating files.

Resource limits can be validated before the database opens:

config = briskdb.Config(shards=4, max_result_rows=5_000)
db = briskdb.open("./data", config=config)

To serve that same open database to browser/HTTP and PostgreSQL clients:

with briskdb.open("./data") as db:
    with db.serve(postgres="127.0.0.1:0") as server:
        print(server.http_address)      # actual address; port 0 is resolved
        print(server.postgres_address)

HTTP and unauthenticated PostgreSQL are loopback-only. To expose PostgreSQL on another address, pass postgres_tls_cert, postgres_tls_key, postgres_user, and postgres_password_file to serve(); TLS plus SCRAM-SHA-256 are then required for every database session. The password is read from the file, never passed as a Python string. Closing a server leaves the database usable; closing the database first closes all of its attached servers. The asyncio API provides await db.serve() and an AsyncServer context manager with the same lifecycle.

Database and session handles own their native resources, close() is idempotent, and blocking engine work releases Python's GIL. Dropping live handles during interpreter shutdown is also safe.

Multiple independently spawned Python processes may open the same ready data directory on one local Linux or macOS host. Each process must create its own handle; use multiprocessing.get_context("spawn"), not an inherited live handle after fork(). Schema changes require every peer to close first and otherwise return retryable BusyError. See the multi-process contract.

Synchronous handles support with; the asyncio facade keeps engine work off the event loop and propagates task cancellation into Rust:

async with await briskdb.open_async("./data") as db:
    async with await db.session(routing_key="account-1") as session:
        rows = await session.query("SELECT body FROM notes WHERE id = ?1", [1])

See sync and asyncio usage for transactions, streaming cursors, deadlines, cancellation, thread/task safety, and the intentionally unclaimed DB-API compatibility surface. The API reference, platform matrix, and serverless-shaped warm-handler example define the supported package surface and its current boundaries.

This is an alpha API. SQL supports None, bool, bounded integers, float, str, bytes-like values, and exact decimal.Decimal conversion with explicit errors when SQLite cannot store a value losslessly. See the executable value and exception contract for boundaries and the stable BriskDBError hierarchy.

The extension uses the host-controlled listeners and documents Rust features and does not include the daemon CLI, signal handler, or logging subscriber. Enabling documents starts no MongoDB listener.

Release files for briskdb 0.1.0a6

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

Source distribution (sdist)

Source distribution for briskdb 0.1.0a6
File Size Uploaded
briskdb-0.1.0a6.tar.gz 3.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for briskdb 0.1.0a6
File
briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
briskdb-0.1.0a6-cp39-abi3-macosx_11_0_x86_64.whl CPython 3.9 abi3 macOS 11.0+ x86-64 Details
briskdb-0.1.0a6-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 39.4 MB

Release files / briskdb-0.1.0a6.tar.gz

Download URL briskdb-0.1.0a6.tar.gz
Size 3.9 MB
Tags Source
SHA-256 checksum
How to use checksums
c68120502ba29a0eb57b43891c906456cd7600adf921a1d5ace9d7d8259972e3
BLAKE2b-256 checksum
How to use checksums
2ba89a8e13f463424d15c398a9b6a03720f178d76f550ee50938f04f05507ef8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_x86_64.whl
Size 9.4 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2fff5e488702017ea82cd1c10213bbfad6051c65213ce696ba9171cba5519aa4
BLAKE2b-256 checksum
How to use checksums
3a626ab010533901d5b862cfcc18b1f24f96c22347e0a752c15e64ce7262d776
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL briskdb-0.1.0a6-cp39-abi3-manylinux_2_28_aarch64.whl
Size 8.8 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
603be334a763351edbfc28d682319907e668676dc990fab8f71e2adcf66c578e
BLAKE2b-256 checksum
How to use checksums
624f4877177ad133e32e2554c002f4bec70205fbf9175533416bd37ae76f33b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / briskdb-0.1.0a6-cp39-abi3-macosx_11_0_x86_64.whl

Download URL briskdb-0.1.0a6-cp39-abi3-macosx_11_0_x86_64.whl
Size 9.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
29e60eba8e21a184018db328a8ea5af95d43a9fcc23f6941d5cc176d7cffbb62
BLAKE2b-256 checksum
How to use checksums
dd1693975c1cc59eabd18d454bab9021eac32c7e1e41f892eb10a28f05200be5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / briskdb-0.1.0a6-cp39-abi3-macosx_11_0_arm64.whl

Download URL briskdb-0.1.0a6-cp39-abi3-macosx_11_0_arm64.whl
Size 8.4 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
08c814b7d25293cd41863ba1d684c8c3ed044d12bbbd2e97386877de12e3012c
BLAKE2b-256 checksum
How to use checksums
fd58f4f572c57f9909a1f8d014ac7a2d1e0a8455d93b05909bc99c916cee0579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
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