propagate attr keys to live views - #1
Merged
cmalinmayor merged 1 commit intoJul 31, 2026
Merged
Conversation
Author
|
@cmalinmayor, I somehow cannot ask you to review this, because it is your own fork. So therefore this message 😊✋ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: this is a PR to @cmalinmayor's
graph-viewPR!Propagate new attribute keys to live views
Builds on royerlab#325 (graph-views).
royerlab#325 makes a view follow its root for attribute writes and node adds, but not for
add_node_attr_key/add_edge_attr_key. So a view created before the key was registered never learns about it, and the write that royerlab#325 propagates back into that view gets rejected:The root is fine; the error comes from the view's local store. Only SQLGraph roots hit this. A rustworkx-rooted view shares the root's attribute dicts and reports the root's key list, so it picks new keys up for free.
Same problem when registering through one view: its siblings never see the key.
What changed
BaseGraph._maintain_views_attr_key, the schema counterpart of the existing_maintain_views_node_attrs, called fromadd_node_attr_key/add_edge_attr_keyinSQLGraphandRustWorkXGraph.GraphView._apply_root_attr_keyholds the local backfill that used to be inlined inGraphView.add_node_attr_key/add_edge_attr_key. Those now just delegate to the root, so registering through a view takes the same path and reaches the sibling views too.test_subgraph.py, parametrized over all backends.The rustworkx call sites look redundant since
_apply_root_attr_keyreturns early for rustworkx roots, but they aren't: a view built with an explicitnode_attr_keysstill needs the new key appended to that pinned list. The old inline code did that append unconditionally, so the append happens before the early return.Costs nothing on the hot paths — this only runs on
add_*_attr_key, which on SQL already does anALTER TABLE.Not covered
remove_node_attr_key/remove_edge_attr_keyhave the mirror-image gap: a key removed on the root is still reported by existing views. Left out of this PR; happy to do it here if you'd rather have the schema path symmetric in one go.