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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.22-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.22-cp313-cp313-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.22-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.22-cp312-cp312-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.22-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.22-cp311-cp311-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.22-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.22-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.22.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.22.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.22.tar.gz
Algorithm Hash digest
SHA256 4168c92d22c81551544c8d791869ece87243766979ab8bbe11c99175c8d1093e
MD5 7cd562bd942f0df2abcad7f20f1e31f9
BLAKE2b-256 8927d2b4753ee075ef8637794b96ea4a70f9525dac5b27eba62f913095ea9a41

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.22-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.22-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c1f2be325563f37605a886ae1ba0001ffa4b3ff347a495f8901e07cd84bb9104
MD5 fbb629c665dc2bc84050760bca8887df
BLAKE2b-256 61674f153a8ab87e493d132b1c0c6e98655ddb6a31b12052e0f9e06b5ae3e543

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e8030b4e3292b1992d2c1563ce5aa004011ee218495bff3ac6698cb1bbb6dbe4
MD5 19e95710f8f517921a7a91161d3d03a1
BLAKE2b-256 bc1aba299264fc1ba7ad9c77e803ce4611e81e0e7978c74b9217488d8e7c1a31

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 5c93000dcabe323d825e4742e12b464654b40431052cf1c59fae6df519028226
MD5 4bab0d171957002944a9ce4a42867724
BLAKE2b-256 0b5f04960b379feb774c288bbd9ffe194c58150bc17464aa9b0b4810e26b86cb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.22-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.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b350d4bbea66fda9446890a51b559fb32750dbb232f802f6907465066397622a
MD5 66191b15b68aec72f4b761203f5623e0
BLAKE2b-256 971580ade2369ad120c26720c747546207a5e377084e68bdb186d45f9e848f4f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5ff84f0181c0a81dba91ba7193e967e33499c231942f9650358e94361d100ee8
MD5 9029785669192631820165b7af54b454
BLAKE2b-256 7ec98ca79bb8a982f91e5ace3e7f614da8d867315bc061a56ababdaa74ad1e5a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 8d610f0585a70ba4bb621c9e2acf1ff20dabb62c8e5b4f8a89b80bd494e9ea43
MD5 6253799783a4eadf2e8e9c27601e7bca
BLAKE2b-256 80a08c7550a6ed56e3d67ac500e36a2e8ddda790760048cbc6f6245861f1bac2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.22-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.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf9b0eb8af1309f8826156af2d9b20e1764272e8e946e194d93b7b016961f521
MD5 c5a88f04231ec15382ce0ef38af81842
BLAKE2b-256 7f7922b4ae2a9e243680c339d3db0c4c2f4961b26c8e3398426617164d0f2a10

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af9ff82f8e08ac479d897848439063f7f3467d0d3d3bf32f1db24dc824b0dae7
MD5 0bdc43dea420ec8ec2c2632671fa16ab
BLAKE2b-256 8d420ba889158b6ceb334c4f9f4be57ff42f0efce571d885c97b74f9fc4f3a15

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 b786c5bc803b8618be848f67cd96b5855895ff0b331b9df06828b0cc6154a988
MD5 ecc591edccc0e1800942ee9ef8f71773
BLAKE2b-256 72c59a2834983a988f749b634b3e6c5b717ff0ddf4cc8d3a659e97eec91bfb88

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.22-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.22-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 01f0137819176e1c4a54aa351e3e21d7cb266b9ba6063ba5cb770d726db40a7a
MD5 7169395e386761cddacbc6711c9c5269
BLAKE2b-256 9a4f52779e4547f90d54708842af72d94fc94586bc9d4709cd6a74231841d6be

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb57a974a68fc0c1d1c6368921f8c1a108075a2bcdfbb70eb2320955d651fed6
MD5 71f7c0cafe4c3d8b4b513b64aef1f493
BLAKE2b-256 795daf00bc2c6e8ad66e776ea7fe742b684052e57e01caf5ff83e4fc6b308be5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.22-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 3f60e0d15fc612b7bedf3b74b571121d0a7933891cb4dd9db609daf8745bb76e
MD5 d5737e47636a24b73cad9c211c3facdf
BLAKE2b-256 85e72e7c86134691ce98e673b3c0acb50e1888e82e0350ae8d7f796b54776a7f

See more details on using hashes here.

Provenance

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