Skip to main content

Pure Python TCP driver for RocheDB

Project description

RocheDB Python Driver

Pure Python TCP driver for RocheDB.

This driver talks to roched over RocheDB's high-level wire protocol. It does not reimplement RocheDB's ring-key, period, head-angle, or placement rules. Applications pass a human-readable ring name, and RocheDB returns a typed ID.

Status

  • package: PyPI rochedb v0.1.3
  • current mode: native TCP wire driver
  • Python: 3.10+
  • runtime dependencies: none
  • RocheDB core: running roched node or cluster

Implemented:

  • persistent TCP connections
  • wire_version / health
  • put / put_codec / put_json / put_nif / put_bif
  • get / get_encoded / get_text / get_json
  • query / query_encoded / query_text / query_json
  • codec metadata negotiation with CODECMETA ON
  • batch_get
  • typed RocheId
  • one reconnect retry
  • context manager support

Planned:

  • authentication / secret-key handshake support
  • retrieve / atlas wire APIs once the public wire contract is finalized for drivers
  • ring-read filters/projection once the public wire contract is finalized for drivers
  • connection pooling

Install

Install the published package from PyPI:

python3 -m pip install rochedb

For local driver development, install from a checkout:

python3 -m pip install -e .

Build roched from the RocheDB core repository:

git clone https://github.com/puffball1567/rochedb.git
cd rochedb
nimble install -y
nim c -d:release --nimcache:/tmp/nimcache_roched -o:src/roched src/roched.nim

Example

from rochedb import RocheClient

with RocheClient.connect("127.0.0.1:17301") as db:
    doc_id = db.put_json(
        "docs/japan/support",
        {"title": "Tokyo support note", "country": "JP"},
        vector=[1.0, 0.0],
    )

    print(db.get_json(doc_id))
    print(db.get_encoded(doc_id).codec)
    print(db.query_json(doc_id, "{ title }"))

Test

From this driver repository, point ROCHEDB_CORE_DIR at a RocheDB checkout:

ROCHEDB_CORE_DIR=/path/to/rochedb python3 -m unittest discover -s tests

The test starts a two-node local roched cluster and verifies put/get/query, JSON helpers, codec metadata, BIF opaque payloads, wire_version, and batch_get.

Why A Native Wire Driver?

The Python driver is intended for API services, scripts, experiments, and AI/RAG validation where a running RocheDB server or cluster is the natural boundary. It keeps Python out of RocheDB's placement internals and uses the same ring-oriented API that other external drivers should use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rochedb-0.1.3.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rochedb-0.1.3-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file rochedb-0.1.3.tar.gz.

File metadata

  • Download URL: rochedb-0.1.3.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for rochedb-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1f5d7e6b815dc7bf51417230f4de825ec6f0485dbdcbc5680e66e8274a7ee5f2
MD5 f8b8d2e450473e1ef25a980b97bd9535
BLAKE2b-256 6d12e4f5a53ac05880aa772d2d1e590eccfa71daf45a50c67dcbd3e613304e9a

See more details on using hashes here.

File details

Details for the file rochedb-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rochedb-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for rochedb-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5104bdc61e14b9c674fbeceac6a5a1df31cf192dd5c0b2c20f981ef7d6a76527
MD5 d57a4cdb50a689a85fb49895146f1faf
BLAKE2b-256 edee940f7f5c76c75c3b3fa41e384706918c030c705b181e6429323f135b8b65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page