graph

apply_delete_policy

Apply a delete policy to bound graph facts.

db.graphs.apply_delete_policy(primitive: 'str', key: 'str', policy: 'str', *, space: 'Optional[str]' = None) -> 'Any'

wire graph_apply_delete_policy

Applies an explicit policy to every graph node bound to the given entity target: `cascade` deletes the bound nodes and their incident edges, `detach` keeps the nodes but removes their bindings, and `keep_dangling` preserves the bindings so traversal can report the target's status. The acknowledgement reports how many bound nodes the policy covered.

Successful mutations return an acknowledgement of the outcome: for a state-changing write, the affected target with the mutation effect and commit facts; for mutations that produce a domain result (such as a branch or a promotion outcome), that result object.

To see the complete help for this command, run:

help(db.graphs.apply_delete_policy)

Example

Cascade-delete graph facts bound to an entity.

_ = db.graphs.create("kb")_ = db.graphs.add_node("kb", "ada", binding={"target": {"primitive": "kv", "space": "default", "key": "user:1"}})_ = db.graphs.apply_delete_policy("kv", "user:1", "cascade")  # cascade removes the bound node and its incident edges.db.graphs.get_node("kb", "ada") is None

Parameters

NameTypeRequiredDescription
policyGraphDeletePolicyyesPolicy to apply: `cascade`, `detach`, or `keep_dangling`.one of: cascade, detach, keep_dangling
targetGraphBindingTargetyesThe bound entity target.
branchstring or nullnoTarget branch. Defaults to the executor handle branch.
spacestring or nullnoTarget product space. Defaults to `"default"`.

Returns

MutationAck<GraphDeletePolicyApply>

  • dataobject
  • typestring

Errors

Recover by code. Retry policy and commit outcome come from the shipped error registry.

← All 31 Graph commands

agents: this page as markdown → /docs/reference/graph/apply_delete_policy.md