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.2.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.2-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

zyxdb-0.1.2-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.2.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 df187842eac4d9b880f90873e487dc11e2eeff1d2f45f894ea9e2580e11b1e1f
MD5 10a7a32ab9a9c51d25ff16c927825006
BLAKE2b-256 e4e0ddd71eccc2a25c9758c7374afed672e3cc29aef2d15266acf7edd9917d33

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.2-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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b733dd2dfb7a6caa228a8d262facd027185f83e4f2e542b96e03ec5e78e686d
MD5 e8a3c7ba964693c916c0e73587b486e9
BLAKE2b-256 8ed3a6bdc7fa61e498967293aad1f6e80c1df174b8b59a7a0c130a4dd062bbf5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f42621eee93248fe3193b0d64e7dd77f8b12322ad7c53318abbaf59a189e3e25
MD5 37e550e8252a73da5ca548bb38f94b43
BLAKE2b-256 cdac99bf93327527e2116ffeb2dd31e5b22a9fe199e21144669d38584a274a0b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6e748ee6db729d65776874b4e42ba2f7a0505376bd47cef556862cf292ee721c
MD5 056fba98cc0f31c9a3f3129bb1c7c804
BLAKE2b-256 b8f5a7dd761856c9af3f98d1c50af7037743bcff149acc192219c8e3f7245489

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1ff4dad60575e152a93b097d3851cbf9e707ad8d22979b50f4dcd25d22a3ed5b
MD5 712a9b0052a3f10a702c0f33851c35c9
BLAKE2b-256 ee4ca8cac438b444a9785947b74d20d89d02aea290c6f4d8e95662e7c9b02fc1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 406dd56efe63a327e2ce66662969054850f1c6bd8d503c465a575579309238e1
MD5 bcfe5c89e5e04d8df428a66917332205
BLAKE2b-256 035b15fcc29fe0a7d3154e2440f35bdee57a09d27e11895d10bdac4ef990c66d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 c60b3309f8d8f03539b577db6a635c3fa6d44358e8536e6fffd05bd89d52a522
MD5 42f66349422c4f7ea087abbfe2cdbbce
BLAKE2b-256 279aa77e0f51050502ad7e9d6672148391df987f12f7474b4d3dc001259a19a6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 475d4166c6b3925f9613bee5850098b7fa9542e7444ef408d430a3a221c92772
MD5 c022f509c6988862645aacb9f18817fe
BLAKE2b-256 f1d5e8322848ca6cb8a5d626e6da765c9aaf15cc9b40c98f289be8854424335a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80100f99d3200b479a2fd4793ef606251fa3ff749342ee124a25f54492daa46f
MD5 6494344a378a403f75c56b0eee7e0a96
BLAKE2b-256 7b8f7a20a5b221b35da56d5410914ab191af6d182ee96a5b87e4fa5de2fccbe8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 498547aa201bb34c4527c01ede1d2aad747276afd141857bde2396d9e78d898f
MD5 127ca3669984814dc5aaab3438ae85a8
BLAKE2b-256 67940b166c0a7b2d1b27fae332c0d7271d0c8ce799573e22cd8857529f313eaf

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.2-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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d61f5087ebe5f0ab4124cbd0616c74da47a928af545a52f990830480c1f89e9
MD5 f86286ec3ae041d2c820f777e6f78a51
BLAKE2b-256 e16d40bf9f71287e8759c6f895700a607e9e337712522ed7528777f56c54fb04

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23d7f3c62f4d56fc8237309951156ddcc18adfd1a74211e1502b338044e0664b
MD5 01e127b80be0072fd3bfa2ac1a8863f1
BLAKE2b-256 4d88dac48e940cc9fbf6e1a44ab4cbd0919ed79ecc2d1b82f021cb8b164bf0cb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.2-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 dee2fd0ee1d58961965e51dc014f84170577bcd4c9ccfc428a61a6ef3fe38fdd
MD5 02bce2800b2a7b7dcc8bbc41fbacb968
BLAKE2b-256 55cea9aa42ca04dfab0a9b585b963783acdcdddb840f8a45716d08f9c4ed36a5

See more details on using hashes here.

Provenance

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