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.23.tar.gz (28.7 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.23-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

zyxdb-0.1.23-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.23-cp313-cp313-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.13macOS 13.0+ ARM64

zyxdb-0.1.23-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

zyxdb-0.1.23-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.23-cp312-cp312-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

zyxdb-0.1.23-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

zyxdb-0.1.23-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.23-cp311-cp311-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

zyxdb-0.1.23-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

zyxdb-0.1.23-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.5 MB view details)

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

zyxdb-0.1.23-cp310-cp310-macosx_13_0_arm64.whl (6.7 MB view details)

Uploaded CPython 3.10macOS 13.0+ ARM64

File details

Details for the file zyxdb-0.1.23.tar.gz.

File metadata

  • Download URL: zyxdb-0.1.23.tar.gz
  • Upload date:
  • Size: 28.7 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.23.tar.gz
Algorithm Hash digest
SHA256 00cc9e7a7118e651742117a268ff5dc15a3c3a4ec811b36e495c08ef8c53e940
MD5 825a4e0ae4967c34be582f0ed4c0fcd7
BLAKE2b-256 2f22f05d9bb8ef40f4367302a0001ba0e8fb45f382a9e7899d98f61878f30358

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.23-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.23-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 18fed352f4d0d5f3d7f8ec8fa2e3be95ec63f567333ee17a314af43f4eb125fd
MD5 82aba308adcf0319ffb2398f15dff9f1
BLAKE2b-256 82c800a4129cf185b540ef48d63f7121247a395d7e606e1864b484e46a59b3de

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33a427f9f1e6c37ca4def497d9b1e518350e518aba040a4f64331660a12cda43
MD5 0e02c7002535bf24c5238a218c2d0193
BLAKE2b-256 5a787493deeb82735d3b1a798ec76172b26ad7bf4106789caef514e8eb69d4aa

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 497b7e9e0526f8f6457408314bb29952ca44e2e7c2c7500552aaed4d5d9c35a6
MD5 da0a9b8c40fd01747635e73af68a0670
BLAKE2b-256 a5eeea222477db20b1422170fe3ea13c9f704ccac54e7cbba4c06b971ac86997

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.23-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 798ecde43e29b0eb1a521d52e6a78a252234b074e489e204fff3bcda8e77b49d
MD5 20a775ccd9368358a1febf397b0832cc
BLAKE2b-256 81a1755082c9f2ee3f4ce3e7a05d3b15c621a692ffb853b0e7d55180f2ae055a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad4ff3e2fe801e3192f40fcc9940ea93e5b2f767b29b714586d49aacb038a7d3
MD5 210ed4864d7cb084fd5b10fd0dd2a9d5
BLAKE2b-256 7f25a0fd5931e168082d929ed7c47982e1143af9a21b24299672a6033616d386

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 ca457c90d175bb8e5e34a8aa6fc816ddcf0449d69485bb8e7e9320cc4ef28325
MD5 fd11583ff67161363d375e18c8cb0510
BLAKE2b-256 da1373716d2b6cb6a6d741605999fa46cbfb2ac008cbd28bed55b2a8674e4c4e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.23-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.23-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2f88b5d7119fde1d79153551228851d3284363605c4f2767cd65b510089069c7
MD5 9de54232da2349506dd4b7cac5ce0981
BLAKE2b-256 23f168768b6ad367c51be3cf814a285ca1542fb332b69476b9091056ce2aa42f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 875f7853c8fe210766113aa1ccfd5c1fc6e22159d468732bfef4788d3c8eeb1f
MD5 0f902d241cf3187e2d2e019f0d3eec0f
BLAKE2b-256 abb50db475163ce288a542d709f6045f89ca080cdd41c1ec9ab44d3f42f0f42f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 315ba675d79bde43c47802a99d18d05dfac3d81dcc624f5c74deb61c5f09d095
MD5 25dbb09404051c6776c51668479f8f86
BLAKE2b-256 42f8cf601452f0be38d82c196e4bd5b510698ee34fb21a5c5964dffd89037525

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.23-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.23-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2105735074a5a5486ae31256c0042a8b814f45009135c3e3a2003a3035d0b457
MD5 35d104e104478dafb2ae902abb906245
BLAKE2b-256 e317eda73a8f29c51acb41bcbeac8064609ca488ad3e6369ae420d0f7f59df28

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b084b0d92fd7cfcc72d7881ff3dee41e276dfee01a80b6a1fa12de6b8db105f
MD5 75d79e8033c288175725024bbea35392
BLAKE2b-256 1aa75c572d9834c50b60582765eddef48c798f3c941dd70d24d5a007ba18024b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.23-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 b662b5f6808bed7d8d8f93baea07e06938db179785d79f5bbac97319dc8e6e7b
MD5 6b1df7bb3da2ac02e7b25afe6974dc9f
BLAKE2b-256 6a2b3cfaec601a539f96d27fbb56ed4c9540d787e687b9c78ed3ad2c6c6d2796

See more details on using hashes here.

Provenance

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