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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.15-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.15-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.15.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.15.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.15.tar.gz
Algorithm Hash digest
SHA256 8e25cff601e68dd99f7baf87539f4216bdca1f8124d9d65f8cfda347b885fec1
MD5 ed5584cf944138a4d55c61a9b0a2567b
BLAKE2b-256 6e6eaadbd58b588838d57f5763037e4676cb907bed002ea2fbc5c8179e059113

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.15-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.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2f97104dee275b40600bc4f1fc33539f7dae960b69fe4440efb32a352d989387
MD5 abffa182b2af815ffaae5f7881241c07
BLAKE2b-256 200bf6dbf456e8c2ef9582b3a22aedb7b308725520f8c159702c114038f5a047

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab02fcdf3b59b5513ed445806707b690ef390f06727b3db107db6e337e2cb6ed
MD5 e8e86440847a608ef37bd577f0b09a64
BLAKE2b-256 ecaaa828b01a1a4dd1e5d23acfa57e2cf283b3496355bcad2ffd1ede6abe2f8b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 408083e91c8bd30c283ba742782bf83e41a0d6360f1487c8d99c0a8e08c8e319
MD5 8f88245cd4e1f1b5ce625de05613b6cd
BLAKE2b-256 16be5826d2c634236426794c698c22cb61473bb62111825569d4d5b0c40f36a0

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.15-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.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a8321570a694f46bc35b717a1c91839a0fec6856934bcbdb85d063c4f0cbe73d
MD5 e09690d5c0a00ab2c057e892da89c2d9
BLAKE2b-256 5d69ace5f0c3453e53c879ff91a4fc0050265cae7e0a3744b41592311a6c503f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 909855afbb3b09fd1a59e39c29fd946d9d7656c9d56bffdc163fcf1a39efc308
MD5 74f2bd9c92b6ef51b00149f2b10de8e3
BLAKE2b-256 e32a01ded7dd0807ca9ca64d4b07d95675d86569ee7e7e66c675d7c7a3b95e59

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 17fa7ff32056e641f07599b51d1f9bb202e280a60abfe955531e97ac13c7b6e2
MD5 3af5a3893761c9cc7acf91d8b4e3b7b3
BLAKE2b-256 4223d33d6f49930e1b2b6d3f31186a7c1d093752e034795fe21fba24f3c767af

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.15-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.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ed0eecf0743f5e17456eb47fc3e3502593078164fba96ff9c8739c7d0df07af3
MD5 bff354448e3b5d76643bf049d7186c0e
BLAKE2b-256 61bb253efd1653e72dcf3460c98ab5e890818098ee63fbeddad6819c0f566f47

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9168b6f44e8b6904b51ef39616f4e06af30efae16f5b17f7ef5a923deec6710
MD5 b4fb90222c3f8c2c03e8175b66eb6364
BLAKE2b-256 b92592dd089b6c9fe1564ab726b50c0fb7c1de0bd6cad861b105a6d0d419a9d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 24c9a46174f42996a14dac97d12b278746b4431ac954bee8038d15cb8d05aaf6
MD5 17d92ac37d738dbec7d39081583af19f
BLAKE2b-256 6e0fca63ead832f3d7a285f5c2eaaca1ba5a921ee717e4d6b51b6d242e40ec54

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.15-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.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 263e7988bddfee3e048a27916ff94a95eb890bcc36a848f0b2cd5a70ad4ba665
MD5 33c66219d71df81175e79c5c4d82c13f
BLAKE2b-256 a0918e97bbd898b62ea05bdd1b5e7d49d8c293b30ec1092046ed0d4d05a5ad46

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4ea357c0d77a01d208b699a9a7a46492d787296ccd0086e749dd58833088977e
MD5 92c02c092d5edc75491b3dd90cd0c5a9
BLAKE2b-256 476e60ef10b88781290298d21a351cba5c80eb474416dd5b30e2eea33ea49d75

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.15-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 98d5104be5895ec66611ae6be2dc12b72fdd798fb6644d5c0ac2fbb7aa69535a
MD5 a8dbaa2b6d8eeacb7bf1bec9752e6599
BLAKE2b-256 18b2680730406fdc8048336736dd0b470ea64a503923d877f3484ec934abfc40

See more details on using hashes here.

Provenance

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