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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.4-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.4-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.4.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a7f19f958025c90e1a83260abab2dc094329ffd8c5160470d2d1f17cf19890e9
MD5 7423e3efa647dd014605ce9897f6f80e
BLAKE2b-256 77c801b6173875625d11a10528cb61979d386e7c27da8d8f95009c9971b9605d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.4-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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bb918ce519652ff07ccfef889b18e605a7ed93def8deb1d68659d3cb0db61a26
MD5 7b530a08e7fcad8a12131e1db2eb0f4e
BLAKE2b-256 cfe948727a14a8ad669d2da1d9e4e89f89ad373f2140454a236e64847866cdcd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e22ba1513cdbaee04bfaa0a77ac884982d5e77d916094fea2c902a3fad3fa54
MD5 25acfab8cac73b5d17437d387a6b78db
BLAKE2b-256 06fad421468dc7a310024f2234ef258524c3b646988996f6a2f54a1415af678d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 15b4001b39c66ed2a08d86c62097f5fb841d856a9184430acc22b8622c53f0ec
MD5 c1e945fbd655aee4896179b524ce0450
BLAKE2b-256 0c4a518a0a28101a463f67e0813286e1a38e2043bf91f0fa5043062f18585f09

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.4-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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e912bca006cb50f0fda3bbcf0761f2659fdb489088eedfbff713cbb4308c69bd
MD5 ba35e69929e1e0267dd7dc2fe2058b88
BLAKE2b-256 23af8f30c4e30c3b6cb505b6fc1b66b455a6a9eee310e57f29adf96416a2078a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 19f6fb3f3b855cb822c35b1d1f6bc98e0d6ddbce701e3efa21f48ab0a0876dc7
MD5 448769d9dd4f852b7746a5f31dc8429a
BLAKE2b-256 7d8f82463e7a9ecb263446e95fedb02727c0671adb979ed7f88a1a347cc7b739

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 5f87fd9c102f900c6f82c1b081137a4ece43e34002ec9e97175ab44c7d0cca58
MD5 af634c61cf5d51a6c9ffb93125173d44
BLAKE2b-256 b8cdcc8d7e705c3f6a2fa6b2ea1dd7763f7b0db50c0e8330c1e9ae675e5e682e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.4-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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 81eb89d0aee4b203315591a90f883a2430e84c97dda97fb580dcb1099d8dc2c3
MD5 7c1f3389d231b5f77d4a68ae83d34212
BLAKE2b-256 828b93489be2c2a77b755401226d430b2a32887cab3568c65f51b8a9d56b08c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 08309d479a016e6810712eea73e6b8f94204b983628c85ed8932b3eb74659635
MD5 986a28a0f7e664db64a15ab84099384b
BLAKE2b-256 87a908ff6674a72054137fcba03e69dddfa4a4524ae0e00b428d92535c764028

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ec2ca9030b8618e4081f9ee9cabab6bc36a4a124e2f248d562c7761559d153da
MD5 54dca0cf89d8e2e75e7a05c1498951c4
BLAKE2b-256 eb1f5bb066687c8eecbe92305ec535e54351880b20fc0cc85e9243e4e690e40b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.4-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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f87140fb80497ec6676c67d0490f81de7595c892bf3d7b7768a70e79ef203dfe
MD5 c96ba2547570b49c1505ec2d5a7e1141
BLAKE2b-256 0de154933210e96e619889185d76eed91e38284f333a3b8542d0f3198762bb75

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e3d73e39461ddacf64df8a4410b97f811868ae46a745b7d36d6bd88c1b6a38e
MD5 bc08945f5333c072f95ec71bc688348d
BLAKE2b-256 c4a16714aad321b03eea8b47b3f2d274cbaec9c49c7bb2d83f0e141ecede94f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.4-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 2d3e41802ec1fc1f7a1e796a1d1885c5fc5c6053f0b447f3d610f5476b8a9e9b
MD5 ceeaa7852b5113f659ba5e80f588ca29
BLAKE2b-256 dc60e80807361ca0a01368fa7fe7fbe3332bec82f71e4430af8487bd4124478f

See more details on using hashes here.

Provenance

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