Skip to main content

traverse-embedded

The Traverse graph database inside your Python process, with no server. Open or create a .tvdb file, query it with openCypher or ISO/IEC 39075 GQL, and load data with the bulk writer. Python 3.10+ on Windows x64 and Linux x64.

The import name is traverse. To talk to a Traverse server instead, use traverse-http.

Installation

pip install traverse-embedded

Quick start

import traverse

with traverse.open("people.tvdb") as db:
    db.execute("CREATE (:Person {name: 'Alice', age: 34}), (:Person {name: 'Bob', age: 28})")

    result = db.execute("MATCH (p:Person) WHERE p.age > $age RETURN p.name AS name", {"age": 30})
    print(result.columns, result.data())  # ['name'] [{'name': 'Alice'}]
    print(result.values())  # [('Alice',)]: rows as tuples, the cheapest read of a whole result

    # ISO/IEC 39075 GQL instead of openCypher
    for row in db.execute("MATCH (p:Person) FILTER p.age < 30 RETURN p.name AS name", dialect="gql"):
        print(row["name"])  # Bob

execute on the database runs each query as a transaction of its own: a read runs on a snapshot, a write commits when it succeeds and rolls back when it fails. Closing the database (the end of the with block, or db.close()) saves it, and leaves the .tvdb as a single file.

Transactions

with traverse.open("people.tvdb") as db:
    # commits on a clean exit, rolls back on an exception
    with db.begin() as tx:
        tx.execute("CREATE (:Person {name: 'Carol', age: 41})")
        tx.execute("MATCH (a:Person {name: 'Alice'}), (c:Person {name: 'Carol'}) CREATE (a)-[:KNOWS]->(c)")

    # a snapshot of the database as of now; runs alongside the writer and other readers
    with db.begin_read() as snapshot:
        print(snapshot.execute("MATCH (p:Person) RETURN count(p) AS n").data())  # [{'n': 3}]

One write transaction is active at a time. begin waits for the active one for up to db.busy_timeout seconds (default 5), then raises traverse.BusyError.

Bulk loading

A bulk load is a write transaction that skips the redo log: committing it saves the database with the load in it, so the data is written once. Readers don't see it until then.

with traverse.open("registry.tvdb") as db:
    with db.bulk_writer() as bulk:
        acme = bulk.create_node(["Company"], {"name": "Acme", "founded": 1998})
        globex = bulk.create_node(["Company"], {"name": "Globex", "founded": 2004})
        bulk.create_edge(acme, globex, "OWNS", {"share": 0.6})
        bulk.create_index("company_name", "Company", "name")

A file built this way can be uploaded to a Traverse server and put behind an alias, so queries move to the new data in one step (see the Traverse README).

Timeouts, cancelling and errors

with traverse.open("people.tvdb") as db:
    db.statement_timeout = 30  # seconds a statement may run (None: no limit)
    try:
        db.execute("MATCH (p:Person) RETURN nosuchfunction(p.name)")
    except traverse.TraverseError as e:
        print(e.gql_status)  # 42N48 (unknown function)

A statement that runs past statement_timeout, or that another thread stops with Transaction.cancel(), raises traverse.QueryInterruptedError. Every error is a traverse.TraverseError, with its GQLSTATUS code in gql_status (the ISO/IEC 39075 code where the standard has one).

License

Copyright 2026 The Intelligence Company AB (publ). Licensed under MIT or Apache-2.0, at your option.

Metadata

Release files for traverse-embedded 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for traverse-embedded 0.9.2
File Interpreter ABI Platform Actions
traverse_embedded-0.9.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for traverse_embedded-0.9.2-cp310-abi3-win_amd64.whl
traverse_embedded-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for traverse_embedded-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 17.2 MB

Release files / traverse_embedded-0.9.2-cp310-abi3-win_amd64.whl

Download URL traverse_embedded-0.9.2-cp310-abi3-win_amd64.whl
Size 8.7 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d325a5bdde257a8987d72c7b4407be0a02e7e849256da618946a37e93902805e
BLAKE2b-256 checksum
How to use checksums
76a69b734e4a569dd7de6a46d6ba4b4cdbf10cf50e0794457192e6bffecb13a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / traverse_embedded-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL traverse_embedded-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.5 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
13fe7ab34f0f3195e9fd41166adedc647c8338059d783ab8153d9ca8dc682f72
BLAKE2b-256 checksum
How to use checksums
c3ff2e9f39709bbee07c1965ad37fdb15fc24fd71cbd25a77f5fb65a6ed086a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for traverse-embedded 0.9.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page