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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 13.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 13.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 13.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

File metadata

  • Download URL: zyxdb-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 bfa5e347d999ac9a4db7cb873f57267c315c389b46e44a9403c5194fcea7fd45
MD5 71319144b785a84092f329cac5401fd1
BLAKE2b-256 62d405f04604d0fd38a252519e838758cf7297ce43af00b39d9132d854aa53ad

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e13ca5346e65b386676168d567b5228e91d1528480c1ec3ad3fd38124519c9e2
MD5 ef183645361f39db8389e86531172777
BLAKE2b-256 e551170b64c95cb6632e3e0e4926e139317d94c8d51e460f4902f66fbe05b96f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 900f1e7f537f7a295814a682d90477826291d4eebaef03c02e2e70034435238a
MD5 a4db1306b8f35b98db29740c82656c1a
BLAKE2b-256 486ec19a4270a32c274e8baf4349da04fc3b1f093239911301d80c30f5108e9f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp313-cp313-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 59474f241a854987e628c5854c486fff0f811edfff9c8dff771e1863a322ef1c
MD5 57bee2706b0161c2e5ed36cd019d2bed
BLAKE2b-256 743b2ddd6af6074fbce5c91945f0d21fcf6edbb7b167bf8b5f72b5d068377bd2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ea006e8014de0ba5f1ee1a1a6e05924e82841f8fd4aecb8ec48cc60140b9480f
MD5 0569e31a1db8f8aef605eadab0e3746a
BLAKE2b-256 6c07885c6c5384351071cfc74116157291810e3b520c2820fc84d270be5f5b9b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5a4fa72eb74f9f21ca1d40a524eba96a27f04ef3890addb8d14d661d8df4945e
MD5 147cfb59e6373d5662f928e6654c09cd
BLAKE2b-256 bea4fdbfadf8eae1139bcde5fa98fda0ed032ad88f88f1c9994526204a459ff8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 1fbf4cf42af89fdab7a5a1074599a659a32cc9df0ea5ea81c98169e693a92dc6
MD5 530ae96a2705d1765f4bc1975e437aca
BLAKE2b-256 ca2837aa647d458855ddbde1b4e170342974d00c83eaedfd9b0925385122b550

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6bbf76ea1bd7bc009be559f58bc7dc09e80d00832f3f77955ae2a78096374109
MD5 06c1771898284bea3d8cee7ba437435c
BLAKE2b-256 17baf3e4ebb345f96905b9746b0bd5227faef39bd345716f59920ed42780d093

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8243e25b75ccaaac995cd325fc3e6bbfa7114ac4370fda2f384eb19d4e048856
MD5 159bdc62125b4e11412a22f95fd2253b
BLAKE2b-256 14c6db570437143a36f08c173239d4929d6c89887132e4172282640e3bc066c1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 0733e4e41b2e6767ed758885ec7bd677d764bc1db0f6dba01df54a82a65b6dfb
MD5 930f8123978cb468ba075bf13221765e
BLAKE2b-256 c44b0060e3e1eaac4e33dfe88b59b9eb18be2aa998d870d41b0d9c9a0e67f251

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: zyxdb-0.1.3-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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f5079119101ddcf93911ed93f68c873e94cdf01f6a7fe6feb0c4a2fdf98cb2a0
MD5 7face9882226cc07efdf55bcdbf4baf5
BLAKE2b-256 ce09500fedc353ee4d81d442a2e26b08bc343465b717ac839b57fbce4e8ba17d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 98f960a74ef4636c32b3fc228fa1c9ca18d0a66b3a0888a7ab1a46cef29074ab
MD5 5f5ab22a5cf9f6a997463289c0d99a57
BLAKE2b-256 be9f744c662856df91aadbbe2e9e65f14f8fef4cdf3bed22d9cef9ed9bb4b362

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for zyxdb-0.1.3-cp310-cp310-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 1e905139085a8af8dbd385e3a95346d8bc5023aafda1b1782eb7e85beef6b51d
MD5 8d9688089c1fef18134a9801f9316c2c
BLAKE2b-256 6a2b266acf83407f63b0cbfe15ddacf47167718654c72192bc00a78b4e99bb33

See more details on using hashes here.

Provenance

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