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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.21-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.21-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.21.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.21.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.21.tar.gz
Algorithm Hash digest
SHA256 5d4df092e086f6c93068aca36d9eda5a38476538dbb8202c4802ab7aab6bbca3
MD5 4482d53015ad36cfc1c0219f8ca1cd80
BLAKE2b-256 5814e9d29f10ba1ebd2d3273fc89845b82397597a323918becb0eba95224a21c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.21-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.21-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7bbd04e146301938c409836383cc9915fd41b74dd3940d6d3131ea42b29756d7
MD5 5badaa4a39f6933416a5039b04f408a7
BLAKE2b-256 9ad5cd5909b6703891562c179ffc377e1d368b94f24c00cb6e8619354f179406

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b070429aa4c0f6ed017675d1a9af5c727f8a0c68928204b686400b690df9989
MD5 7f37294c1800f05dda375d6df94185dd
BLAKE2b-256 9f66b86aafcce1eac0e0bedbf1d8401bade1e4f89cff008807f88bedf57811c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 f6c63a85c3eafc9e914e515b2f88a85594f67d7fa90c0b2466af629a45d4f53e
MD5 ef678ee195a119ba6033baac7fb25fc3
BLAKE2b-256 544c0251cfc39716dd9b5df30963545c1db2d8999f78eb6f2b79c256951c4980

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.21-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.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6f43541147f00e12ef3bd19d0cd9b55eada1e6dc870745525f2774e1566cf43f
MD5 faac2e533387e84305ebb443e8bb9be4
BLAKE2b-256 71a5c285b16e0b7d40502cca9797fafeb7404182696b3a61aa68dce5976bb86f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3444abe9dcc9a4ca9d78423f2ba72d00acd803485bf4fbd1ad57c18f052695ea
MD5 58480d1ddf4d8e1e635e8b80211a2665
BLAKE2b-256 02eb4b5b2a4002d4ad8e73a84a48d9ce9983be601bc9b8b0ddea3b1f584c483b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 d75830b70a7db297237eb55cf5bb830eb3b497fa7c27e16ba9e083c5a20ec4bc
MD5 5656f37d30c9487af86fcc988686e9c6
BLAKE2b-256 68758916819d2124c4d5ba19ae1e3707f552db21f0e464e0d71fc498cf0d56c4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.21-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.21-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7b9c254d2427e0ff9ea0cd628d97b7d3b54cd3e82e9bfbf42afd5f1a9b1951f5
MD5 d59894947ad598344e26298fc87ca85b
BLAKE2b-256 7a9ea8bcb6f91660a1b362b0ddc82ebbf22e36157d70105c64b755101a8fb344

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25bbfda2b9ac290fb1a78d4d43d39c98dbcfa5940e0996fe0262d7a01b22e2dc
MD5 53c51dc663cfc517df74610b73f99788
BLAKE2b-256 1c34944e5574a1cbc727a9b2daf484e03c97555dc966da399f551cd1f8a371ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 97d47befcee355a0f24c6ab6893e28899ba8670450e6600aa3a582466cca9bf5
MD5 5f819a51cf545903fb72fe378eec5c9e
BLAKE2b-256 c39bdde4f92a7921b468d41b0dca828a4b4665d3919931a79f497c0daa96bfd2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.21-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.21-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 42d163eeb4b554c24db34d3b365cb59b6ca62d1df740b6ebd07fde92f9230ad0
MD5 6e31f3e61e8aa78f0794d83ad5b06a76
BLAKE2b-256 8bc9d8a2390d8cc637e2f7479f1199a461c75ef74109dfb9c0ec61405fb252f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eaca58972587bd333b4ab751eb9fabbbd12bb965fe009c67bfd62aa4f22af368
MD5 50b71b0468c3c6acdadfd68943ba497c
BLAKE2b-256 ab68f5aeca43a6d4871af73910abc3bc73186d53b75659115ea65f3b45c45f67

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.21-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 f5d259f03ff0c15ec4026edc4414fbcb89b488057fa3d98ab330408d9d6e2a20
MD5 4b3d0d2267bc88ee700807f440b0c41d
BLAKE2b-256 a53c57eff0ca28df60bc6e3c330924ec5e33ca0c03364d7788a427cb0160deb1

See more details on using hashes here.

Provenance

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