For the complete documentation index optimized for AI agents, see llms.txt.Queries for HelixDB can be authored directly in Python with the
helix-db package,
imported as helixdb. The Python SDK pairs a query-builder DSL with a small
sync HTTP client. The API is Pythonic (read_batch, write_batch, var_as,
value_map) and emits the same dynamic-query JSON AST as the Rust, TypeScript,
and Go SDKs.
For the traversal model and query patterns themselves, see
Querying and the Querying Guide.
Prerequisites
- Python 3.10 or later.
- Optional: uv for fast environment and dependency management.
- Optional: the Helix CLI for local development and ad-hoc query testing.
Create a project
Add the dependency
Install thehelix-db package from PyPI.
helixdb:
helix_db, is also available for codebases that prefer
underscore package names.
With uv, run your script through the managed environment:
Write query functions
Python query builders are normal functions returningReadBatch or WriteBatch.
Use define_params for runtime values and pass the returned refs into predicates,
limits, property inputs, search inputs, and mutations.
Build dynamic requests
A batch becomes a dynamic request withto_dynamic_request(...) or
to_dynamic_json(...):
request_type, query_name, query, parameters, and
parameter_types, ready to POST to /v1/query.
Execute queries
Create the client once and reuse it:warm_only():
/v1/query/{name}:
Write queries
read_batch().var_as(...) rejects write traversals. Use write_batch() for any
node/edge creation, property update/removal, drop, or index mutation.
Bundles
Python can also generate query bundles:4, matching the other SDKs.
Handle conflicts in application code
The Python client does not retry HTTP409 Conflict responses automatically. Retry
only when the operation is safe to replay. Remote errors are raised as HelixError
with kind == "Remote", details, and status_code populated.
Next Steps
Querying
Dynamic query envelopes, client execution, and transactions.
Parameters & bundles
Parameter serialization across TypeScript, Rust, Go, and Python.
Local Development
Run HelixDB locally while developing queries.
Python SDK source
Python package source and README.