Skip to main content

Python bindings for ZYX graph database engine

Project description

zyxdb

Python bindings for ZYX, a high-performance embeddable graph database engine with Cypher query support.

Installation

pip install zyxdb

Build from source

cd bindings/python
pip install -e ".[test]"

Quick Start

import zyxdb

# Open a database (creates if not exists, auto-closes on exit)
with zyxdb.Database("/tmp/movies") as db:

    # Create nodes — returns node ID (int)
    alice = db.create_node("Person", {"name": "Alice", "age": 30})
    bob   = db.create_node("Person", {"name": "Bob",   "age": 25})
    carol = db.create_node("Person", {"name": "Carol", "age": 35})

    # Create edges between nodes
    db.create_edge(alice, bob,   "FRIENDS_WITH")
    db.create_edge(bob,   carol, "FRIENDS_WITH")

    # Cypher works too — with parameterized queries
    db.execute("CREATE (m:Movie {title: $title, year: $year})",
               title="The Matrix", year=1999)

    # Transactions — all or nothing
    with db.begin_transaction() as tx:
        tx.execute(
            "MATCH (p:Person {name: 'Alice'}), (m:Movie {title: 'The Matrix'}) "
            "CREATE (p)-[:RATED {score: 9.5}]->(m)"
        )
        tx.execute(
            "MATCH (p:Person {name: 'Bob'}), (m:Movie {title: 'The Matrix'}) "
            "CREATE (p)-[:RATED {score: 10.0}]->(m)"
        )
        tx.commit()

    # Query with iteration
    for row in db.execute(
        "MATCH (p:Person)-[r:RATED]->(m:Movie) "
        "RETURN p.name AS person, m.title AS movie, r.score AS score"
    ):
        print(f"{row['person']} rated {row['movie']} {row['score']}/10")

    # Read-only transaction for safe reads
    with db.begin_read_only_transaction() as tx:
        for row in tx.execute("MATCH (p:Person) RETURN count(p) AS cnt"):
            print(f"Total people: {row['cnt']}")

    # Shortest path
    path = db.get_shortest_path(alice, carol)
    names = [n.properties["name"] for n in path]
    print(" -> ".join(names))  # Alice -> Bob -> Carol

Supported Value Types

Python ZYX
None null
bool bool
int int64
float double
str string
list[float] vector (embeddings)
list[str] string list
list (mixed) heterogeneous list
dict map

API Reference

Database(path, *, open=True)

  • execute(cypher, **params) — Execute Cypher query with keyword parameters
  • begin_transaction() — Start a read-write transaction
  • begin_read_only_transaction() — Start a read-only transaction
  • create_node(label, props) — Create a node, return its ID (label can be str or list[str])
  • create_nodes(label, props_list) — Batch create nodes, return list of IDs
  • create_edge(src_id, dst_id, edge_type, props) — Create edge between two nodes by ID
  • create_edges(edge_type, edges) — Batch create edges
  • get_shortest_path(start_id, end_id, max_depth=15) — Find shortest path, return list of Node
  • bfs(start_id, visitor) — Breadth-first traversal
  • save() — Flush to disk
  • close() — Close the database
  • has_active_transaction — Whether there is an active transaction

Transaction

  • execute(cypher, **params) — Execute within transaction
  • commit() — Commit changes
  • rollback() — Roll back changes
  • is_active — Whether transaction is still active
  • is_read_only — Whether read-only

Result

  • Iterable: for row in result yields Record objects
  • columns / column_names — List of column names
  • is_success — Whether query succeeded
  • error — Error message or None
  • duration — Query execution time (ms)
  • fetchone() — Fetch next row or None
  • fetchall() — Fetch all remaining rows
  • fetchmany(size) — Fetch up to size rows
  • single(strict=True) — Return the single result row
  • scalar() — Return first column of first row
  • data() — Return all rows as list of dicts
  • to_df() — Convert to pandas DataFrame

License

Apache License 2.0

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

zyxdb-0.1.5.tar.gz (27.8 kB view details)

Uploaded Source

Built Distributions

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

zyxdb-0.1.5-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

zyxdb-0.1.5-cp313-cp313-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

zyxdb-0.1.5-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

zyxdb-0.1.5-cp312-cp312-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

zyxdb-0.1.5-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

zyxdb-0.1.5-cp311-cp311-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

zyxdb-0.1.5-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

zyxdb-0.1.5-cp310-cp310-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

Details for the file zyxdb-0.1.5.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.5.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zyxdb-0.1.5.tar.gz
Algorithm Hash digest
SHA256 9df8914977cf0e5833e1f965705a845b8751efff7e3c220de47b25528c78c562
MD5 49520832994175c01014234165ea800e
BLAKE2b-256 f4b6680f5ee5a930541b95e0132ed02300de06feacecb7296eec1b3933f0112c

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5.tar.gz:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zyxdb-0.1.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2a79f852807671a58c8f89e502d4c26cc2cfae1a04ba78901fb57bc921c2ef9a
MD5 a2743ab29abe97bee7f032a98b1289c1
BLAKE2b-256 88b6c53247b5d4c544028603a4283a8d4cb906ec1504aceea193e1c0e61b79f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp313-cp313-win_amd64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1842e0fd62cea33fa3df3a5487e93421d51d36b066b2b216b949f938601336dd
MD5 bfe9962a60226a0489ed2317905c5181
BLAKE2b-256 a081b929d6df5659643b8408a4975d7dbea67846f807e8554945ae1263c08c92

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6b22e00e075b9bb98db72f56c7f2a6c9ee6a68ce4ef981fba2f858ebd97431d8
MD5 59c417cc960d57aad69226958f0544b8
BLAKE2b-256 2ac5129fff764a17a686d168a0f2f5c1db06bc282a7129b2761e000da118a2b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp313-cp313-macosx_13_0_arm64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zyxdb-0.1.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1326caca7eb59568ae34a6287e230d706abb89a72884248b19faa6462d6435b6
MD5 101f8a756c920fdb8f80491e95a27d6c
BLAKE2b-256 19ddf413b5768b075032b9b2941d1ba95fb61df5ab84f220d8ae3993808c3b47

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp312-cp312-win_amd64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3482ecf12405aa396f6a1e02727230e07b8964d227a01fab8dea7b6a011b0806
MD5 5e37d6c11a08a3287efdb7ea367b650e
BLAKE2b-256 4b1b0724b01f7232d0e539daf3a4ecd30c486e92749da99088c9d100a0502d7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 659d5ba03c641231630d1b9ceb651769ce32255a34a238d1e9b87434b2ac947b
MD5 458bb298309f3efe5bb7aa380fc50e66
BLAKE2b-256 d78ff23d5d4e5fb103afa17e9c25fb357b4b1885cfd0b4b5fa11a1888e967f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp312-cp312-macosx_13_0_arm64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zyxdb-0.1.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 488c6987954cbed99233ae1fa1b05a290d92f0c517a1d5ddd6c3bb0724cec37c
MD5 61e32fbc6072cd47733c1d374e8cf646
BLAKE2b-256 4dfca58db433ec4f7ee391e70541fe2d69c0a75abdaa9467b0fa7cad5b02c9ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp311-cp311-win_amd64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de860000c8b7e8a94561ff4dbafd329edab835532932f1452686f05af0f33f0f
MD5 31054570a5f8a400ee0638460f7859e3
BLAKE2b-256 d4cbc17fdc313398f47557281928f061fbf3d211da56870136b48b746589f47c

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2b64d4833d4fe93419c961fb6d957208b5f2de90ea0742b6fc6668aa0de6675c
MD5 baeca5ef2421c0deee9e21cd361f30b4
BLAKE2b-256 793bb6725dc51db15c29a2c60112f518c6c6f228bcb2beca04977476abeb6fec

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp311-cp311-macosx_13_0_arm64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zyxdb-0.1.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c566fa76643b31aae042c58027e046001337391c0af7f62485a13b6167dc2f18
MD5 e5faa0d85171adb27f2d9a4b36617d90
BLAKE2b-256 3a6cef483bf89cbe0d47a9ccf6eaf27c0f992738c167b646c644720c13e86750

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp310-cp310-win_amd64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 855a1f1ab0b182595f26efa4813a66a71f26cf7a66a43ca93442244148baad2e
MD5 715ffb1d28aa43bf2423f62d6bc863b1
BLAKE2b-256 c2bbff2a56e86d13f08e6ed08b9e9c88d354606bf9f6a3f2c299b06673d45241

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zyxdb-0.1.5-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.5-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ffa1d563dc543c502d4d7fce7969a83a1c0db4896cff4032298a6391786267dc
MD5 0b8e055c294c5f10db5805c4173f6bf3
BLAKE2b-256 25db4794c1ef0aa788a34005b2000c8566ae0fd51f039e94dd5c2dd528e29cce

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.5-cp310-cp310-macosx_13_0_arm64.whl:

Publisher: python-bindings.yml on nexepic/zyx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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