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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

zyxdb-0.1.1-cp313-cp313-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

zyxdb-0.1.1-cp312-cp312-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

zyxdb-0.1.1-cp311-cp311-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

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

zyxdb-0.1.1-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.1.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.1.tar.gz
  • Upload date:
  • Size: 25.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.1.tar.gz
Algorithm Hash digest
SHA256 8aab98733ae75d284122bed6704458db8fc12baf637e25865be1f2ea3e6443f2
MD5 d282917aa72a0f2050c233c315ac0bba
BLAKE2b-256 d63fe7364192923521d9654a4627117657090c278e8c7a2be44b7bda2ee34db4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 02c4bc717e53818401739b6f0e444df979cc596e060c1f071b1b162941108b22
MD5 8723fb12d3132fc013bbc7006b6c21a9
BLAKE2b-256 42180611ed857e86629d162cd7e716589f991e70892fe509e136c9bcc5d3b44b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2bf166fc42a292955ead399e27c0d0c4d1cdccaade46e0f7f961d5f0dc7cf12
MD5 59fb758f9da74af4fbd213ac5a54542d
BLAKE2b-256 a37e8af8e204def10a574f5a9e2c89547252b240fa528319f9b9d569b35512ca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 7defa6034c7a815a2033c27d4cedf16e3316dd546437851d3b3e014657b9665b
MD5 6b8a1de8189ae705d3ea04a7ada0cde1
BLAKE2b-256 1c2896af39b8d9f582353d0a1ea0ec15dc95619c7e4e2999a2f2c13d7ecf65c5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a64f7820a94bc2c00eefd194347d8cbf61250d31ba24ad99a2e7dc9b2cebad89
MD5 1b56fcb57564a4a21874d9d05bb438c2
BLAKE2b-256 d61a30b1e6bd255db4b9a3162fc445fa3c974f7402bc95a6560d7d3fe6d46430

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab511c06e762b452957efb71cfeb93787fa64a27904c7c5ec56dff8944f1d953
MD5 6aedb51999cb27ad5c136d6b2b0f9d97
BLAKE2b-256 2cfde896f2284badfc4fe06f656ee2e177089009a584c35b44a1ba95ec601757

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 3db23b32ad9402c0175148959245e1fc0dd09d15b8224c8810efbc835278f845
MD5 c186994eb6c5d33896e5a43256ce73e7
BLAKE2b-256 b92d743f0c93304a1351363d3cda5c48c8099285edc6ba81c54690559caa96a7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8b06cad00fafccc5b513c1619730bac535df954a9f1e5d78b4449d1bb49e49dc
MD5 d50117eb21cb637d5366b35b93ef4eba
BLAKE2b-256 f85882785e8084d7787f4c02a327b2b3e4caaefe282c914d9e6bfa3835f9dfec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7140587ace9cc365f1ec279d3bd27efd47ad0236db01259974eae303af856a49
MD5 04c09acd3eadaabb5a270444804e86a6
BLAKE2b-256 3a3114d82328c99f5b9b1b5b1d335b389b1d23d07a2122905699370000361394

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 597b083415026be72803f6e574826d0db71abc77491c7d1c9f3ffceac03d462f
MD5 f4eaa2094a535f9422f6992c81df191b
BLAKE2b-256 00db46cd63aa9367625fc4c3f1110a11d40c391e6d04bd2c2c02b07349beff49

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 52fdeadbb9df00924b2e002535d7429b7732ad934cd28fc5d6c993b9b7f91985
MD5 da0a4429c194fbe223b7c2862bdc2e65
BLAKE2b-256 8436477cce842b0282b46be46ffa3516d4ba70d3ba1a25c9fabf8dca0c48a740

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25fcf9acb0659b58ec5f1f1c9d485a61693844a99329efa12c293891a19b8ec2
MD5 f9b0eb68975ee5c4882b43b54a4ae498
BLAKE2b-256 c83e8c249c00123b6ada22910a31a3aebce4aa2ed44d4fb2182749d4c64f0968

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.1-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 000e437bde2fdca53f106feb2112a95f85c50ddf70b80feb421252464de598d4
MD5 e234d331ec1da0918c9f9f7f6135c01a
BLAKE2b-256 70fbb53de14c46c5e5f97eecd49dc773410cb413cf1ffb1c034718d9f6e7fb0f

See more details on using hashes here.

Provenance

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