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

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.7-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.7-cp313-cp313-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.7-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.7-cp312-cp312-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.7-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.7-cp311-cp311-macosx_13_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

File metadata

  • Download URL: zyxdb-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 0001851f14860d4704ad4dc7fefbdbea6db5793999e40d79d81903ad980ea4be
MD5 f78dcfc4f0bb9bcda588b3106263dbde
BLAKE2b-256 008ec70428941a94187c9367287ac4183d032faa1608cb5255f0774664f2ed99

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.7-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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c1bacb025536e17844adc15b475617443c31f4a92c66414ead06818ef8b51751
MD5 9e8190bb2f8587dc4dc0832c82d5424c
BLAKE2b-256 baebc4d3ea48147c9fc1d95b55b032275ef901fd27c38f4d2367a2437838bc5d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7cf2163994e1517683714298d5c27dbcba866e5b83a836c50ebcd1860cb885d1
MD5 959538d7cc665473ff15b4c38758bc4b
BLAKE2b-256 b9969551cef270de519b5a1ed892c0f57662a8ba4647226830179d0a8a5baa06

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 7be67ea6571c5d5eb9fba0310ed3a6b482fd242d6611644106b7497b8b17bd1a
MD5 1adba856dd85ab42396eab41aab8b6c2
BLAKE2b-256 5445942831d6ab8b38ed67e4fd371dfbc29807112a149b38189dfec69140e9e9

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.7-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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5ce836dbe1265b4cc0a439caf6ac653db3155ad137cf6708a8838b0a43194858
MD5 91878dbb6bb6e802671b54df98dad9ea
BLAKE2b-256 18ba64a0d771d4654339be8e3da195aee636319d432ad59f3dbebb85e9885fd3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e8ac1ad42af48e26043e9da0ab9b693c0431a0ed96c814525e22fbbed0a9dd6
MD5 cc78e2dda9c40c19322ab8d829a12905
BLAKE2b-256 6c939dade30b0c0ec53ee0d99c15bc05aa6a24ee2a7a4fea9ff71ff79a7f8c1e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 647c0b62b372cc4ea926f53deb053f64c421cf23286d76ec5932a02880b7a414
MD5 c5a360787e0d40c53dfbe4fc499a4216
BLAKE2b-256 58a54bd0d5c01e107028343ebcb8c2fdb64328ecc6d2662dace9da94e900f5d7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.7-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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e5c2cfc786823d7806dbd1d50142b1cf569d6e9576e41d2d359f6a30e19ccb59
MD5 eb42dd5ebada891498c15fb8973a8bc8
BLAKE2b-256 841c97c484492a35d5af8b0bf0ebb3cf2d5ad08ef7c362b437bbb7af941e3749

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5776aba9c35c774d70cc225377151083ebc92e1b41f13419825f94aa3fb0dc3d
MD5 e2ba398b1578721453df96c8ffde53f4
BLAKE2b-256 a3dfe405343752b2f3989664967b057d7ee3dc3e8e49b973cc88af8de10b7e02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 eb6f7c8a6e8d8121ca503aa6adaaae80e61298a943c76d97d13955b86b0d3ef5
MD5 6d76a72ae3c4c7d5ae77dc4403a5e851
BLAKE2b-256 4edec5e024d204c5060bef2f33eaf40d5f87b16d1531efe276986895b8b49c85

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.7-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.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 012ceb1c2f9e015cb2809b6e7767b62bf45f564e795f30fb44f24e45e6480afe
MD5 0c0ed00dddfc2d9f137df8e35e5783c2
BLAKE2b-256 5faed61f8b33f547c8e397a5fbd74ac2d4272e744f0648d79e0f2c552d0eee01

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 66a134c24391451a4e61b1a10eaa304ee7fa1ce1183587740fa3eb50a51a2b4d
MD5 16b36eb396c0bad487034ddd946c3744
BLAKE2b-256 5c6c476019b94a60f21492a860fe42101f8a15541f2b7faa072a8a393c39dc52

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.7-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 cc80a6111cb411cc2992e5ca7255fed0329e1f35507ab95b93f3b229f14e6bb5
MD5 298bc3c12d1c7a69794454a8a7f57f6f
BLAKE2b-256 c02d246e97264d8796d4f5f251abd68044502588811540617741afc621beaaa2

See more details on using hashes here.

Provenance

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