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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

zyxdb-0.1.8-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.8.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.8.tar.gz
  • Upload date:
  • Size: 27.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.8.tar.gz
Algorithm Hash digest
SHA256 12658e072a8c19a079bd3134ca63c4720fb88f06feddb3f004bc71857a73eb7e
MD5 4ff42ccfe379880368ed642ecf5e3475
BLAKE2b-256 a8b89eb6ce3cd0bd9885ea848e8be02d130833ff9bc5972f322fd03bb244b125

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.8-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.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 816cf302aa84f9a6ae20137f5e888b499e082fec66957bb4d0735e1d6611da53
MD5 93ce8c15ecab19c50bb757c89d300d0a
BLAKE2b-256 57173b3fe67bcdb896c15130f50115ab478ac5ecad9fa0e17f70d8d4d50e915f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 381a99debfc763053c1b3b8e8e8f2e6b4d6ffa8e08e3ac10139d7c1308ced882
MD5 12a4edad1c1792ed217c67c36e3b9a99
BLAKE2b-256 a3e43172f5945aba7c5bc46b9ee8c39e4b15a85d7a2e4a32c63fe690041bc76f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 7193bf08c297ee3627d5bd4545c9ad42b0e22e6b7c420b751c7f3f555cc00b69
MD5 e5bb06275cadedca9206e8db4bcce7e4
BLAKE2b-256 797694e5fcccd5add9e558a2a8315bca4743c64a2ae9ade1ca082fc5f6cceda6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.8-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.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 58ad40700aa72fe88bb1d5295084a1ca4d92c52dc5c7fe6965fff0f8ad342919
MD5 ca9fb96d85f73119f7885dc8abc69a16
BLAKE2b-256 25952c42d4d19230e411e24f33b8196af601febf5845e02b51aede590aea9461

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3fbb46cbb022c71ea287ef2b8db44e11c01c911ed62dcc0e87c3d572f550bae6
MD5 9db930219bcde2655d01809878d149f0
BLAKE2b-256 746be33adbae923c9b7c3a8ae0d2909462b8d011a9c5a44f69830e6bf7b0f7a1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 d4213f322fea2b13a65ff410857059756f812b37d0e815291a8cf09d45925aaa
MD5 4d72d2a75ac77cf090493710718ff9f1
BLAKE2b-256 06bdada90582e90df182b728ba1a81b0893467c95f69e3a13c43a0cedaf217bd

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.8-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.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2d3923d37527d6f107e41186439713dee721004e746c2f98791f5b5363c92466
MD5 599b806adcfaf20d5ee0357a15e25feb
BLAKE2b-256 75e742c2ef2c8f3b656f8a2045cd8fc7ee4b6d5ccd6b81450b5ffea567d25e2f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f14038b1bb613bb409adde725d936d7395ddcf4b6e6822bf1ca9141c01639d94
MD5 9d50d9cc5e7b681e581386e120f18b33
BLAKE2b-256 1909d74e12a6980e32b2103f298532037ba018a47ae4120ffd2f7b088257c84e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6e3e11365406a2161489320ba48eaf1e7d93fe3e8b8f94608a7f5d49cad30fa4
MD5 51453d2646bf86c4059ebfa74fe2da04
BLAKE2b-256 ebef8fa2252f6a5532b60bfd21a71e987b1c5f8e4d720c56efbf9b443510ff1b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.8-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.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 da8ae649f3999a6e5238c98a65a15eea99e78c0787b54827fddec33d79f829e8
MD5 2f0776d9f7b54b7128448737a21b3100
BLAKE2b-256 d4ba628d5e79c45248fbb63c48522f2d10f924413059e393184f94d4014cf8ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7648c4b3ffeac83dce2cc88ff3c6d60bf99812895d2a1e7dbc58fd328899ab4d
MD5 0bd30c2318693866fcadae64ec9945eb
BLAKE2b-256 6a0cbe40daedb919272c6c4ff364876d80874233c7b8c21303d59b2487169926

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.8-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 52038c39a6efb28f4017626e91fb2966ebc18f1b4766d4ff9915c07ef1cc5694
MD5 45108a2db415789fb17873e78eaf9b1b
BLAKE2b-256 92faef82d9bbc0555cc156962b0716fce9348893565e10d5f564e9da0290c79a

See more details on using hashes here.

Provenance

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