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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.17-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.17-cp313-cp313-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.17-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.17-cp312-cp312-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.17-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.17-cp311-cp311-macosx_13_0_arm64.whl (6.6 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.17-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.17-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.17.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.17.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.17.tar.gz
Algorithm Hash digest
SHA256 8cbbf0a9e22e1d6ab27e7efacfd7cc6db6e8c7aedf92491ea1c8795e4e9acb0f
MD5 0afa8a6cd84236175016859960f65e74
BLAKE2b-256 3e5f838d3149dc83b14f4532dbdd6aba116077e31fca42fe78a91d0a6073995a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.17-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.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bca20c14c4864e9748cd78dbdf4198e3cf8e8f9b53c0d86ddb613b77b6c0d6a5
MD5 2ba45358b48842b8ba145fa06fa2eddd
BLAKE2b-256 99ae7a11e8696aeda12503086b348e1044860ad8793e33878ff24dbc1a90bf8e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5acc648727e371939befb8cd268f9a2dce8f653a79280a14a295b5ab0a23b58
MD5 603b5c5a360815909132caaf80e15071
BLAKE2b-256 c7e306371e9de1c323f00c53404c75f5387420bb2a01b9dd7b417d9c9c7ac22b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 202a53f8aae8a0871877f07d1732f9a8bc5fd9483d2e4b4490af219e72d20981
MD5 487bccc7b3b2ac5ebb3ac9aa17a511cc
BLAKE2b-256 2d8d0cad75b2107a075dd91fb8da65965581f6941d5ebc7d4cd113fcd6122e8f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.17-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.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8609d932575dba46a82bf0aa1167d12278a7a2c2733a4a7cf60c6c228f8b4c0c
MD5 5bcb7fae5f433590aa3a048f5fb5b721
BLAKE2b-256 ca0c428f9927172a787d5fc0fab7992ebdda9ec5376debb525b80dafc23c058f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8e9d68c28202e472fd33258708f4cec0ce38502cbb4963bd38c2a2a29774fc2c
MD5 34dea8fd0026251cde62eda1a620533a
BLAKE2b-256 2221b4db76a365eddbabbf5503d60d4172a557c114c6db217cf8e64260f67aa5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 3d44cc984baa258bd661cfaf1eaa2341d1803d2144191a8c1a078c4ee59ad078
MD5 c05ef1f6bc2a476d218cf68bd15c17ac
BLAKE2b-256 1702635d777adb30f9779b4e0596b9d2cccd3452ec3debe8ef160eaed114d2bb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.17-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.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e77dc74bba19f764ce036fbd03d6cab80c57a968fd668c554d074b2e0bcc9c1b
MD5 a612ddf8831a29b2e578dba7d859a9f2
BLAKE2b-256 1f288a294b188f97b1159ed73f82a0698217f66bde39b8810807c6ad9db0942e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e49c301922b86585e80a2de12a64613130204d735fd2491f86eeca8e2145ede5
MD5 09d35b2094f1a1ce021a40dfc279312f
BLAKE2b-256 8519ccd1436b9430d0e9b0cf12345c1cd6524f3329c46c29aa90108d496d0e59

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 183e2c1bea69cb06a0b92160c61ec75a339ff58446ae404bc56d21d072842143
MD5 ce4644d1e47d06753571b27523105b23
BLAKE2b-256 f04f2f23ac28a47fc9eec8774b34b2850a435201d6d70bc871245582f82efc08

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.17-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.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d596fe001df50c14b0e76230c63ea826be4cf916ab007d5dea5e2b9cc035c472
MD5 5f80ba2376a9c0adc7a63205b0942899
BLAKE2b-256 3e453ecc3be6356e4a4d552ddf3594c7ee156c83926dd08eaa97d08288bea822

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1dbd8a24ad083f4c7a5d534e06640a44dfcb11677b54b3b971a0e2be37289f22
MD5 13941a05e453a57b232a9c9da6178905
BLAKE2b-256 f18b208135105b2e0b631ccb449c46d2d7d00e66c4aa2bd802794be3850c242f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.17-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ea0dc3b1331f96f711699959116abed7c825bf90349fe4eaf502fc743fc2cdcf
MD5 578002779d7cfabed7c0a55dd4a703ab
BLAKE2b-256 87561d4deb2f0fde1c439d248b7bc067767a6085e0bb50c71049d28ee797960b

See more details on using hashes here.

Provenance

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