Skip to main content

cuttledb — Python client for CuttleDB

pip install cuttledb
from cuttledb import CuttleDB, ColType

with CuttleDB.connect("127.0.0.1", 7780) as db:
    hid = db.open()
    tid = db.create(hid, "memory", [
        ("text",      ColType.STRING),
        ("embedding", ColType.VEC, 768),
    ])

    db.insert(hid, tid, ["hello world", [0.1] * 768])

    hits = db.knn(hid, tid, col=1, k=5, query=[0.1] * 768)
    for row_id, score in hits:
        print(score, db.get(hid, tid, row_id))

See the full feature set and use cases in the CuttleDB project README.

API surface

Method Returns Notes
CuttleDB.connect(host, port) CuttleDB classmethod, returns connected client; use as context manager
db.open() int new handle id
db.create(hid, name, [(col, type), …]) int new table id
db.insert(hid, tid, values) int new row id
db.insert_batch(hid, tid, rows) list[int] pipelined; bulk-load 1000 rows in <40ms
db.get(hid, tid, row_id) list[str] values returned as strings (no type coercion)
db.count(hid, tid) int O(1)
db.sum / .min / .max(hid, tid, col) float SUM O(1); MIN/MAX SIMD
db.fcount_gt(hid, tid, col, threshold) int SIMD predicate scan
db.select_gt(hid, tid, col, threshold) list[list[str]] all matching rows
db.knn(hid, tid, col, k, query) list[(row_id, score)] cosine, sorted desc
db.delete(hid, tid, row_id) bool swap-with-last
db.save(hid, path) / db.load(path) str / int binary snapshot
db.sub(hid, tid) / db.unsub(hid, tid) str register/cancel push subscription
db.poll_events(timeout) list[Event] drain pending push events
with db.stream_events() as events: … iterator generator-style event loop
db.log(hid, tid, since=0) (cursor, events) per-table change ring buffer
db.ping() / db.hello() / db.info() / db.stats(...) str / dict server meta

All methods raise CuttleDBError on -ERR … responses or protocol violations.

Concurrency model

CuttleDB is thread-compatible but not thread-safe — calls serialize through an internal lock, so multiple threads on one connection won't corrupt the wire protocol, but they will not run in parallel either. For parallel workloads, open one connection per worker. The server is multi-client (thread-per-connection) so this scales.

Subscriptions without a background thread

The Python SDK is intentionally single-threaded. For real-time push:

db.sub(hid, tid)

# blocking loop with a poll interval
while True:
    for evt in db.poll_events(timeout=1.0):
        handle(evt)

Or the generator form:

with db.stream_events(poll_interval=0.1) as events:
    for evt in events:
        handle(evt)

If you need true background push (callbacks fired from a reader thread), wrap poll_events in your own thread — it's three lines.

Metadata

Release files for cuttledb 0.9.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 cuttledb 0.9.0
File Size Uploaded Provenance Actions
cuttledb-0.9.0.tar.gz 111.1 kB With provenance Details for cuttledb-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cuttledb 0.9.0
File Interpreter ABI Platform Actions
cuttledb-0.9.0-py3-none-any.whl Python 3 none any Details for cuttledb-0.9.0-py3-none-any.whl

Total release size: 142.5 kB

Release files / cuttledb-0.9.0.tar.gz

Download URL cuttledb-0.9.0.tar.gz
Size 111.1 kB
Tags Source
SHA-256 checksum
How to use checksums
be8e2ef591970b61ed11839306eca8d9c238bec261753386c2f4e03d61051c47
BLAKE2b-256 checksum
How to use checksums
eb0a8751a693b398d67fcba496a3261fe116850fa9ca33e71f1e90a405109a97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 8, 2026.

Transparency log

Release files / cuttledb-0.9.0-py3-none-any.whl

Download URL cuttledb-0.9.0-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1b571072dc527c486ccdd7b926a7c0852cace708de63f6f1f5378592fabab82
BLAKE2b-256 checksum
How to use checksums
a8f11ebc35599c5514044acb8a53fa25399f8af8b68924121f3911472d968d9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 8, 2026.

Transparency log

Security for cuttledb 0.9.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cuttledb-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 8, 2026.

Transparency log

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