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.1

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

Total release size: 17.2 MB

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

Download URL traverse_embedded-0.9.1-cp310-abi3-win_amd64.whl
Size 8.7 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
adfb8bf5b63362d354b9efb79d560b67ce39f507690f961a149a1d27e1f3cffe
BLAKE2b-256 checksum
How to use checksums
168ace6db68334d06b323da267c2bf7988a23514a48e9ed75096ef1b0e06b93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

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

Download URL traverse_embedded-0.9.1-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
b0d165c6ed8f7146b1753d6d63d49a7b883e39a2d31f95f0490a405e114e9764
BLAKE2b-256 checksum
How to use checksums
84818f4d4e1cd2164d9ba7ad6860727c5b52137e4bf1397bd19381cbde45ef92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for traverse-embedded 0.9.1

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