agrag.graphdb.base.GraphStoreTransaction
Bases: Protocol
The read/write/upsert surface available inside transactional work.
A structural type, not a base class: GraphStore itself satisfies it
(the default run_in_transaction() passes self), and a backend's own
transaction handle, such as Neo4j's, satisfies it without inheriting from
anything here.
Functions:
- execute_read – Run a read inside the surrounding transaction.
- execute_write – Run a write inside the surrounding transaction.
- upsert_nodes – Write or merge nodes inside the surrounding transaction.
- upsert_relations – Write or merge relationships inside the surrounding transaction.
execute_read
execute_read(query:str, parameters:Mapping[str, Any] | None = None) -> list[dict[str, Any]]
Run a read inside the surrounding transaction.
execute_write
execute_write(query:str, parameters:Mapping[str, Any] | None = None) -> list[dict[str, Any]]
Run a write inside the surrounding transaction.
upsert_nodes
upsert_nodes(label:str, nodes:Sequence[NodeRecord], *, batch_size:int = 256, pending_job_id:UUID | None = None, deferred:DeferredWrites | None = None) -> UpsertResult | None
Write or merge nodes inside the surrounding transaction.
pending_job_id tags the rows the call creates. A write that reaches
a row the job did not create is not applied and is added to deferred,
which is required when pending_job_id is set.
Raises:
GraphStoreWriteConflictError–deferredis None and a row is owned by another in-flight job. The transaction rolls back.
upsert_relations
upsert_relations(relations:Sequence[RelationRecord], *, batch_size:int = 256, pending_job_id:UUID | None = None, deferred:DeferredWrites | None = None) -> UpsertResult | None
Write or merge relationships inside the surrounding transaction.
pending_job_id tags the rows the call creates. A write that reaches
a row the job did not create is not applied and is added to deferred,
which is required when pending_job_id is set.
Raises:
GraphStoreWriteConflictError–deferredis None and a relationship is owned by another in-flight job. The transaction rolls back.