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'}]

    # 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.0

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.0
File Interpreter ABI Platform Actions
traverse_embedded-0.9.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for traverse_embedded-0.9.0-cp310-abi3-win_amd64.whl
traverse_embedded-0.9.0-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.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 16.3 MB

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

Download URL traverse_embedded-0.9.0-cp310-abi3-win_amd64.whl
Size 8.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
343cffef9af51c43a067c5cd1de673189bad62a017c6750b8223228d5ba7a297
BLAKE2b-256 checksum
How to use checksums
591bb41b88a0f4fdfb1f7d8a9d81d969679e957a23472bedc750e173a8e8f39a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

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

Download URL traverse_embedded-0.9.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 8.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
4692690937bc43088ee7083813571f71dbb9148420e79ced1197f28cecf5e7d2
BLAKE2b-256 checksum
How to use checksums
56336a82881a652f24792549a2ae2b32448ebcc49248d46240adcad1513f3d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for traverse-embedded 0.9.0

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