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.24.tar.gz (28.7 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.24-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.24-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.24-cp313-cp313-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

zyxdb-0.1.24-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.24-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.24-cp312-cp312-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

zyxdb-0.1.24-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.24-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.24-cp311-cp311-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

zyxdb-0.1.24-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.24-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.24-cp310-cp310-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

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

File metadata

  • Download URL: zyxdb-0.1.24.tar.gz
  • Upload date:
  • Size: 28.7 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.24.tar.gz
Algorithm Hash digest
SHA256 339a2b97b9eef6a634eff5840141a6dea798db3a095607eb213b2bed276ff747
MD5 11b9abba48b9235db2f90f593b5ded55
BLAKE2b-256 f2a2fb9c248a4d14457855c65b886ed8cba1b514d0fec0a1a906c1a7c648097e

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24.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.24-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.24-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.24-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 abea0919163fd62805ece274c1384a69e12b3e048b37debb2cbd2a7c5ccc6cd3
MD5 c4df98f59f2a498dece316eea6448781
BLAKE2b-256 b28c3798bd87b25ae0f3ca3b29f308d28c3f40ffbc262d880d17485582be3f46

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0a39f8cbe4d595f367e46e3ced5e2ae5f767e3f41e1d1b271ffe6bf85841c749
MD5 db407690b1288702624204136bf77d44
BLAKE2b-256 328fcfb9e1c7a91e67bc2b83d925d173bc4b0f312dab330ad0136105a55e16cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp313-cp313-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2fa6bde615fa655a6c8d8a9c0d6932a7252fedab7c332f90480d2f34d42490e2
MD5 80612d555cab53d745df6ae7d6f75518
BLAKE2b-256 b2cc464384cedc2d6f8815b74b4cdf6b5cb28c69895a26f921dc149c40a0d16a

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.24-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.24-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c700ac432e68511631c6a2be00cee231d2648ac515edab918c8e623c628eb7c7
MD5 457d2903dd2c9dcf4903660f401592bd
BLAKE2b-256 1ccf5826bb7c68486c0c9d586bfad8fb20783249be36b9937d947b6e67a66d01

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 04e5af7650ab40ed01e47321a108cb0731cce1abdb05d7fec100530c7f8639e6
MD5 ba413eed9784bdb73e0fc246f7254bb6
BLAKE2b-256 e53a415f0976613c57e2f02f3a7792b2a989050b1dc590b362e3d393d0d9f8a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 58a8ed62328bae1fa3ec88fe7573dba8a6570546e9bdedb2caec26a035247a06
MD5 a4469e193fda2e03f37923f70d12ec78
BLAKE2b-256 d7d418bec17a6a785e4b6fb94782ab899076bdf4c1edc47b4ca935d701aba87f

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.24-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.24-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a92528b29b5bc67ec4db9360425c5f8dfd454e60ddf34191578821c28ad65fd0
MD5 091bffdf1e89b100c3adf5f5a73c614d
BLAKE2b-256 f1e373d972e4c2997ecd459bde7f7a973273aecc50bb99030dd49ece12bfefe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2eeb5f3d14e0c686770ad9f3cb3bb53818aa3903864c0deeee4e884d2472df4f
MD5 e6c0b6059e3f4e84138d274b77ca6404
BLAKE2b-256 cfb024d792a3e2134418d9f6a58729c27fe5ba2c821679767b74ce372c5b09a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 83092659924b99dd20aeb56a253df83b011cca36d3ba4abd8e677e0e47c31d97
MD5 2483bceb0092ac12e4ded2f11244b609
BLAKE2b-256 9d9eb15be42953b4bf69359888ae54d9a60e73f6b843122f25c94e3ed2b0c8d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: zyxdb-0.1.24-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.24-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ea17da152dddc1330a6f8abf8986859355845ee4f14d81f50e454e29353f607a
MD5 9b058dc8ebfc3661d2512b817c9c3602
BLAKE2b-256 020be319736b6a99eda264095927a27e96757f90119c2be9f8790adda7b73bc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56fd0e07696e19f38c7410cb45eab0bb4055b15e5daaa336f849960d646467df
MD5 530527128f5ba7ea90204e17fa8582c2
BLAKE2b-256 37e6698901d64961a4f5a330c3fc641fac92088d00b4dc7cd0be45bf8624712d

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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.24-cp310-cp310-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for zyxdb-0.1.24-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 236654699b2417980535829b4a586e0bc91872d052c6b5aff773ef9a6ef9a7ec
MD5 f4b5ebafda115921d54ee72abc886dd7
BLAKE2b-256 cd0f5fe71ce690e1e052d862d322df79bb8a123fef803c7158db3dd6ad039ce8

See more details on using hashes here.

Provenance

The following attestation bundles were made for zyxdb-0.1.24-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