httk.store.db.graph¶
Logical storage edges derived from the resolved schema declarations.
The SQL schema deliberately has more than one relationship shape. Keeping those relationships here makes the bulk algorithms independent of whether a backend happens to expose physical foreign-key constraints.
Attributes¶
Classes¶
One typed relationship in the logical storage graph. |
|
Deterministic typed edges for a set of resolved table declarations. |
Module Contents¶
- class httk.store.db.graph.LogicalEdge[source]¶
One typed relationship in the logical storage graph.
source_tableandtarget_tabledescribe the traversal direction.source_columnis the forward sid column for reference, child-element, and dispatch edges. Ownership is traversed from parent to child, so its parent sid column is carried astarget_columnon the child table.
- class httk.store.db.graph.LogicalEdgeGraph[source]¶
Deterministic typed edges for a set of resolved table declarations.
- edges: tuple[LogicalEdge, Ellipsis][source]¶
- classmethod from_schemas(schemas, dispatches=())[source]¶
Build edges from parent schemas, recursively including their targets.
- classmethod from_store(store, schemas)[source]¶
Build a graph using the store’s configured entry-family dispatches.
- sid_columns()[source]¶
Return
table -> (sid_column, referenced_table)mappings.This is the compatibility view used by remapping and reachability code; it includes the parent column of ownership edges as well as the forward columns of the other edge kinds.
- dependency_order(table_names=None)[source]¶
Return a deterministic dependency order, including cyclic schemas.
Reference and child-element dependencies are condensed into strongly connected components. The physical load order places referenced rows before referrers, parents before owned child rows, and backing rows before dispatch rows. Both component selection and members use the lexicographically smallest available table name as their tiebreaker.
- reachability_scc_order()[source]¶
Return SCCs in forward logical-reachability order.
Unlike
dependency_order(), this follows a reference from its source to its target and ownership from parent to child. Consumers propagating root reachability can therefore complete acyclic SCCs in one wave, reserving iteration for genuine cycles.