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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.18-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.18-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.18.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.18.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.18.tar.gz
Algorithm Hash digest
SHA256 0db841fceada4151c59c03c9963e257faa03c2d55712117dc51af4a879916071
MD5 f8999886634c6ebd851960d53edeb2fa
BLAKE2b-256 f939dc8d16243c6d97fa5d21c4844ff7ab5ab5ac70add077a9d2bbd46f40a65e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.18-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.18-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 60784e53d30bd02a93568a46b2e86c5f362f683b164f9a58ee7dc1e75942a3c0
MD5 85839a31a6d5c686cf514f1ca96821db
BLAKE2b-256 d5c7e0bfc1e37e0dd3ad52526d3d3bf48e410319eefe80a0ae62ff5e28226fc2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7b032ab664bba71c0749d8c867c36d084b53ce4bad14459ebdea12826153460
MD5 56fdf65815e666aac707d92fe9d37a08
BLAKE2b-256 e566d5c414d12d6a899ec13036cd334241eb91b42112ddcf6b1a2071e4f751e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 e3d80fbe4604029ed29e81eb8a1fdef958997ca4fc51624fe1da4b2b1fe0afcc
MD5 9d4a3014b2861df5978bdee772e59378
BLAKE2b-256 d81e6524f81c8f3c39c8b8ee83d8d3302fc90887ac6874fe5bbdc77999ea2036

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.18-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.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4ba79f0e4bd22d409f7f31e64a9f6b7316c4f9ea9982eaa4a301b83d7c5e7da8
MD5 321e94985a4777ab2ec11249e4142c23
BLAKE2b-256 70b876f114cf28687b7d317577385517f365b222da36a67435f40a364c962c91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d5a823e03a966daebaaa9e2d62177d06a104561344e63a5b75820046a47fb4f0
MD5 7a1dc4f40cc92705abda396c265db397
BLAKE2b-256 eab14b7b888d209fa01a1d7f2f177119593c67265794e55e495b95c6b7305d02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 93e1e5ca7e3b1888ba25bd7123d1134f072e301c229db96aa4646c8773f0c129
MD5 f26f2be12be3a414ad9fd83b779d6b5b
BLAKE2b-256 58810d8cbddd5cceebfab5839f6e089ae51104cc0bdcb4d7c3d5478886c8c6c5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.18-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.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3ccf661365c143cc796709b32d9cd06b5b9ff96579ed24b693f46e6e67675d52
MD5 2851ab05e559576031457c6991e15e23
BLAKE2b-256 a176c714965dddc6014ecc0633c34278fff3809d1a159d9a1cf24975985ed4e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 574da9a93fee556b8684aea4555b1ce60bb897962abcc3c79580aa56d7ba66ee
MD5 f11cbdba9c7ee971cb5896b2a1ad2bdd
BLAKE2b-256 53c9358bfbfb1a528617781c7972e43ca89f4291e49c731ebad6aa66f1f25a33

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6b02ce03b1eb57affb8082ac46eb98ae00c7e48c3ce6d9fa08ba22ad1d9fb564
MD5 3e78b30d4b066d390c06995fa571fcad
BLAKE2b-256 f71557cfa2bb1e3607a86e72698d702ed90dd59058049500c67572f210449cd6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.18-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.18-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cb1ccc3d6c34ad02b7942b1020abf67d4720f0af3bd82efe7e38e530fc58dccb
MD5 040f6473f88cd224d3b4affd0968672e
BLAKE2b-256 cee3f6e3c366701db5491e252a66f4d2ef8932eb6ef3910ce3bed748c2a885e3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1ac03d4104ba8aff391ff22efa83e2b470b70543b2a602d2f1cf293fd678dae6
MD5 5c500ae50ae5713afc48ae64cc221dfc
BLAKE2b-256 04e4b272e77a25da6028f05c41bb2b2412c0894da8c1bbf379d8191953e3c3c7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.18-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 4fd9f9dd29cb21aae89a5f1cd263d77a6b6413c9a3f65a9507c44b1881bdd26a
MD5 94bc7e86f4c4f812576749c643c51ffc
BLAKE2b-256 4f85e7b7cd658f2ef2f0a1ad3b41f542286687449c06ba737d707037d3f6a440

See more details on using hashes here.

Provenance

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