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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.6-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.6-cp313-cp313-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.6-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.6-cp312-cp312-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.6-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.6-cp311-cp311-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.6-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.6-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.6.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 fdd8abebfdc275b6ad5f5d03343f8eef7209d6a4ff3ec07b133c8a0ead01269a
MD5 62b8fe2608170833db67ac997e527de0
BLAKE2b-256 f0e7e8f30ad3f56f8263518d8394f574b8f9a9b820e1ffd3a26fa46bbc5290c7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.6-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.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b17f7e34d9070c1f34a7be4a4999e7fc605b088bc4c2c2180589896194b53491
MD5 580493cad1a2ef6e4ba768ad5417ff28
BLAKE2b-256 caf14050f20d86e7e03fcc341b57d5ae9dd6c45de3267536eb34ccaeff82f0d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 df6b8a897934fe9d78c68b9476604645b29a9f850ed32d2e3587c687c7b6400c
MD5 72cde10b2d51ff22a5bfdc5c248735df
BLAKE2b-256 4ec81218a3a2c1a9888e6228582def3f87cbb76bfa5c86bd964441581b38eeb4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2290cbb61069b2d0f714afc4a0c9ebc33eaa7a37fd071ab2eb1b3f75430f60aa
MD5 0eec360154e01ebc3980e447cd4aa840
BLAKE2b-256 3c85d5a0d8f874794c6ed65bcf011579da5117652f66c3ec6e43e4490a91fd94

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.6-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.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2bcc2209a6e36fa4a29e99589625119626373947fe4c7140d6517d5b09d7f408
MD5 f5dc7bde14329dec113ff222448e2332
BLAKE2b-256 ec640512e827c539df4acaef98c4ff574a7be2bc5115fa6952748f7980ecde9f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c0d6568e9132911f79f4db8dbbe5b8cc67e1561ad4e70d8afa71a5529972220
MD5 3799aa0a9c350db26fca175a7dccee55
BLAKE2b-256 4b5ecbfb0d7eda803ea2df6abff87122e3634306ead8972fe9b8832370d2336c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 7687e05c8affd3a7818a3d0e58cef2c462dd8b4ed17cfefbd17dd90eeb93b2d4
MD5 437208f77474d7b50a2b033e79de677f
BLAKE2b-256 737d36bfaf12d963a848847b362711d64e9c6f61d8535af8f08334b770bd573f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.6-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.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bd1f94185e489479b46ebc0f0ae3c15968ef3ecde2cfaa2c9302c1c760c855ab
MD5 92d59337278628e74edd22b5daabc4f3
BLAKE2b-256 92652757f6510a0057f31a0abc11b62203b3d2dec0a18b46d197e39cb77dc08d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dcd0609a7ba1e64c94bdafd738ceb6a9f959fd905b68786fb220b65e633ac387
MD5 84f93ed8d382f1ef77f0a4f449570799
BLAKE2b-256 8c2d960b96e0c2e453510e1d03a3ce1080658fee82eb96d4b580fbe01b293e89

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 edc1cc15d8a0059bb1496897c2f46e98c33467ee3329c5124a31ad9d5eb2226e
MD5 9263e6eb3499bd33a2b8ba56e6aa9d75
BLAKE2b-256 ada9af25fd790f3a997dd9a72294a9e9118d3d8920be787945108e12743d9909

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.6-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.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c7b7b585f4ba65f5e1987382927dd8836360e4af4f4fbae40bbc92427a8d68c7
MD5 ccceb39e67a7ceed43eca24049159b37
BLAKE2b-256 8049704b231fbf6899d01d1cb438e7eb52de6afa29d4c04f7e8c0d228744c96a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b27794fe6d48c237f4edf17d67bdc7ff65c1bcd45dde8bfd6ad2bc7b92c5b0c9
MD5 cddfee7da8d5ec3e572ecbe7567dfb73
BLAKE2b-256 2ee50ceb7f744d54d0affa7882eeb7e701d1f47c1a5944a36881f5efd2edb14a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.6-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 0de8f492fd921677a722191cab0c286a186b4a7031597c684448fc5db7583d01
MD5 6d91ad5107371a3caf4e49949d81d567
BLAKE2b-256 8c11b6d9fb4050df1a0d3acc80b4a951545a860e60dc4781b746c2e9876ee2c9

See more details on using hashes here.

Provenance

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