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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.14-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.14-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.14.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.14.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.14.tar.gz
Algorithm Hash digest
SHA256 6710d78ebe67942d15a362640c0a0fa8c230671948fa617eeeea4a7690ab8d68
MD5 b01dfdf0e29927e877083295ee845dc7
BLAKE2b-256 8767f9872222eadd24e745b3b4d0296f1100ebc969c3c184efccaa61320416ed

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.14-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.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ded49fea2337b04e819fa67cb04df8d062ceb0c704d22b016b4317141781af98
MD5 b64d92477ab345e81e2ecce53e762c16
BLAKE2b-256 f3aea3c4c5e103e0b364f7aac1cf4eebb9b3efa00c80648288cdefca3418a1b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 646d778db998b9e8c341c95ba5b28ec5cb7b5030e002e125ab0e5847df5f1758
MD5 95c15b985debb1a1a5773f092ed40bca
BLAKE2b-256 164705ee13e131706b9c70e8eb04bc89f315f4684ae64ba654208f1e3806ec4d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 50c83878580592d507823a125a5a20098f0a1f8b66cb9303d47f14b7d560f9f8
MD5 f3bb5d20599365a673084ab25d0aa1de
BLAKE2b-256 0599ea8b21c347754c90f3557271e6447a0864853d424ffbd5b8c8a8e6a0dd82

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.14-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.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0832e226db3050181ff08696529ad268feeddc42991c0d95b0cb95173dc5d522
MD5 51b5a5e3adab8e256c9a953c4bed6229
BLAKE2b-256 0057bc7c393285f1b017346f3a1107a079bbe29366bc1de4ed45222f9bfb48bc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9918f07a2d0656a3482b0d95b5d29352e0bc0a9f6b583f7138e6c110928a1e3
MD5 e1697c252667b80b1f035c986d3544e7
BLAKE2b-256 5af4100df005ee8314562a565dcfbe11a84e45e053a46b99121791c02a47706f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 cc1c857301d8c7ad3c5678ef171e160fcb12a68fa4527254e8dcd02d3815930d
MD5 1e47c6221db4886d4dcfcc638128fce3
BLAKE2b-256 c53400359981701fb0a44cb741abd08a8765111a3f33b5c915e8a38af58e0dd1

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.14-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.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8628a2b7b19b8c5543106bf9f88c775224f225d1bed5eedc7c5c73b681d5066e
MD5 ae663b9a80d53025d9177e09731b72ac
BLAKE2b-256 2f60f9c9f2d7f1a0b07ee92e1e2315fdf5e855af4ca5281ab643785be40034b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b86f30ec94bac59f74b129051fcc1ff4ffce13a53ee7a6d098040b7bd0a4117
MD5 47a85f2d7f820ca5988d1d10fc657bec
BLAKE2b-256 2f5085e6267c94a0f73f9df96b31ecb87c8a71eaf75a09e05bf083dbf6dfb0b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 71f920c93106dbee803c84feefa0293d7da48a4121953c9d4fec243d01ccdb9f
MD5 f444e3afdd16638444b4cdbe96cf6561
BLAKE2b-256 b4e2df6517c6b59f4e4d3bda9a2722b70748199e93cbb1f8421fa51cdefbb1d6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.14-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.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 468241b8edff6fe159b3869949fb37652e20ef4620a66fb05a4b20f0f4164df0
MD5 dd693cc496d109ebf5e8184d1b4d0852
BLAKE2b-256 0bd6e7a61a1032e8921209228a031f41ef22ee1b932b9e595e4279a6714322ab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9fe917cc3e5585db01bbebc8cf38a2b4219c4f8bc3ef6df31d2b818ddbe4fa26
MD5 76fd4b933245554becde89e02906d9a2
BLAKE2b-256 5e83c8f24b1b71aa89ad492dc9f67d48fafa3c4ad49f504ad9f86a723209153d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.14-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 5b9bd6a1b979d62cf25d64fb245d6d0dbe09d027123a6c6572f39fc1707e75ad
MD5 596263969b4414da41fc34a3ccd6aed5
BLAKE2b-256 106478a9d85a3bfc464ca62a42102070d6f25317a0af1a2592c9b24cbfe00029

See more details on using hashes here.

Provenance

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