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.20.tar.gz (25.6 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.20-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.20-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.2 MB view details)

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

zyxdb-0.1.20-cp313-cp313-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.20-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.2 MB view details)

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

zyxdb-0.1.20-cp312-cp312-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.20-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.2 MB view details)

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

zyxdb-0.1.20-cp311-cp311-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.20-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.2 MB view details)

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

zyxdb-0.1.20-cp310-cp310-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

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

File metadata

  • Download URL: zyxdb-0.1.20.tar.gz
  • Upload date:
  • Size: 25.6 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.20.tar.gz
Algorithm Hash digest
SHA256 68205f9ab081d6614fbd14889885a812b79d0933931fab344d059b7a5789fa26
MD5 0eceec8472c95f4dc0be7ed80049a60f
BLAKE2b-256 574546dea3380f5940742556912d87e87a1ed35ca61a6b956be73a70e5709636

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.20-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.20-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2c6ef93e518e7ec1e7a842e739787c5fb15f63e060958ce1ce0fdba49fd901e0
MD5 acfd7c01deb1de6ceed76dc461257d8b
BLAKE2b-256 8b57770df93f0f01fca563185a01ce351e1ffa698dc63a2c6a68d4db1a752151

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 31e9a1d8c8d25cc6809e4e36072d553ee328f91cbe5cf34de281f7d6a0ea717b
MD5 663c476453f2efa220af2c9aa273f560
BLAKE2b-256 f84c2b3bfc9e7897b3683597b1a539d503597768840dc7138f5881d41ea6825f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 9ae34a5f1d94516fbfe1052bff38a0766a57c14d6be120406367279601d7a8c3
MD5 d73a96ae6fc955a96013223e823ff255
BLAKE2b-256 f56cf26413026e08a9198b8c8126b1e4ab390878087d94b2d5a6ab55aa390a20

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.20-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.20-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4df400f2bee5863fdcc0cf3a1de55749456dc7322763c206260046d0d5ff7188
MD5 fe8a35fd6a426bcf5ff4c90205ca993b
BLAKE2b-256 a1afbacf85941486fefaba011195efde470d3278ff87e30857f24ac0b32a0f47

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b1796ca0acab29358aa18c1af3f647cd6ec0971926968c57597255508d33c5eb
MD5 825fdb5fda36fce20544b7e714a15ae3
BLAKE2b-256 15b78865b61fe3cda2b5665fd086e45f5eaa8a2b5ccc4a38b66f187e739e1b96

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 427467657d82c34b00e810ff4be37c91b54ca6c421c9db58b2b9f2b92e0a571b
MD5 0606ecb1fa48365b584dd1e380db4c32
BLAKE2b-256 11e6c828b69bc6faa872622b8fcf28ef7e22a0e16aa17eeaf530ded70127fa47

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.20-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.20-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 59b5d1e731bd4861ab2f9031c671b78602deae2fbfbad01b3d24636e1f81d459
MD5 8823e8b3b61c870302617935098f4ab4
BLAKE2b-256 f3d8e4b831f918f7009b2f14bc3e377eb2974e0479b7c7c258906108451a50ce

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3851d8da30083cdc033c8ad176f2c29c21e38d71716903c770ecc850e147bd1d
MD5 f0a92826be38ef633538195ddc26d59b
BLAKE2b-256 7e8e48631adddd7dd1472d189b8f63149e2573db5344c6ca119f26e727c7be64

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 774e799a5a096bac1c611740d9871cd71201ddb042985b4a64a04fcd160b3126
MD5 174b5e73f33b61dc15567cc88dee1418
BLAKE2b-256 452748a773604dd6518a2fb56d2be53793d9e92fa640264fc4f9700e5f48c7bc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.20-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.20-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8f5f870e7403e5745923e4b1872a6897ffbfa652ba3669bed020f5c10da9f731
MD5 e87ba14636a873152600004232dc355e
BLAKE2b-256 6beb2197ad9a6a070db69a91ba880bfaace17da3ddce0023fd3021eb0f2241b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33c0ff89dedb283e2aacc298b1eb896f17a7888414cf3b6186ec1ced78f9297c
MD5 304da671f31724891250b9dd8012d362
BLAKE2b-256 34d3d327b490b49d919c04e169a9012a865ed8704d1b655e5414d62116d9adad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.20-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ee117553a43bac6d7ed232e733e8512be8fbb8abe62d4602bade1de670ad9c8d
MD5 8a67379ee0d296dd205a3036893aeddf
BLAKE2b-256 082ba72072c16da3e5e2bbdbb42e5fa89b317dabdd6821181af9cade19b88cdc

See more details on using hashes here.

Provenance

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