Repository navigation
let graphview read missing attributes from root - #340
Open
TeunHuijben wants to merge 2 commits into
Open
TeunHuijben wants to merge 2 commits into
TeunHuijben wants to merge 2 commits into
Conversation
Contributor
Author
|
@JoOkuma / @cmalinmayor, any conceptual thoughts on fetching root attributes when the view doesn't have them? The reason for this feature is the case of enormous SQL graphs on disk. We don't want the heavy |
Contributor
Author
|
@JoOkuma, I pushed a new commit that handles nested views. You might want to keep that in mind on your fork. Thanks! |
This branch has not been deployed
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.
Problem:
GraphViews can be built using only a subset of node attributes.
subgraph(node_attr_keys=[...])lets you build a view without expensive columns, but the view then refuses to read them. If we query the GraphView with an attribute that is missing, it returns a KeyError because that key does not exist.Idea
Actually, that key does exist, and it does in the
rootgraph. So it is possible to get that key for those nodes from therootSolution:
This PR adds
GraphView(root_fallback=True), plumbed throughsubgraph(). When set, reading a node attribute key the view doesn't hold is served from the root for exactly the view's nodes, instead of raising.Off by default. It only ever applies to views built with an explicit
node_attr_keyslist, so opting in costs one kwarg at a call site that's already passing one — and the fetch hits the root's storage, which for a SQL root means a query per read. When it's off, theKeyErrornow points at the flag if the root does have the key.Notes:
attr_keys=Nonestays lean; it never pulls in excluded columns.