Fix ORM over-hydration in measures, dimensions, git_sync APIs - #2434
Draft
shangyian wants to merge 2 commits into
Draft
Fix ORM over-hydration in measures, dimensions, git_sync APIs#2434shangyian wants to merge 2 commits into
shangyian wants to merge 2 commits into
Conversation
- get_node_columns: replace per-column Node.get_by_name (full default load graph + per-column session.refresh) with a single batched Node.get_by_names call, matching columns in Python - get_measure_by_name: drop the full NodeRevision.default_load_options() chain on Column.node_revision, load_only(NodeRevision.name) since that's all ColumnOutput reads - find_nodes_with_dimension: load only Node.id/Node.name instead of the full default load graph, since only those are used downstream - find_nodes_with_common_dimensions: batch the per-dimension get_node_by_name calls into one Node.get_by_names call with a slim load_only(Node.id, Node.name) - sync_node_to_git: switch from Node.cube_load_options() to the slimmer Node.export_load_options(), which already covers cube_elements and everything to_spec touches
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
The batched Node.get_by_names lookup dropped the per-column session.refresh(col, ["node_revision"]) that used to backfill this relationship, so MeasureOutput serialization (column.node_revision.name) lazy-loaded outside the async context and 500'd on POST/PATCH /measures. That's what collapsed measures.py coverage to 64% in CI -- most of the file simply never ran. Restore eager loading via a nested joinedload instead of the old N+1 refresh, and add a 404 test for the new DJNodeNotFound raise in find_nodes_with_common_dimensions.
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.
Summary
get_node_columns: replace per-columnNode.get_by_name(full default load graph + per-column session.refresh) with a single batchedNode.get_by_namescall, matching columns in Pythonget_measure_by_name: drop the fullNodeRevision.default_load_options()chain onColumn.node_revisionand useload_only(NodeRevision.name)since that's allColumnOutputreadsfind_nodes_with_dimension: load onlyNode.id/Node.nameinstead of the full default load graph, since only those are used downstreamfind_nodes_with_common_dimensions: batch the per-dimensionget_node_by_namecalls into oneNode.get_by_namescall with justload_only(Node.id, Node.name)sync_node_to_git: switch fromNode.cube_load_options()to the slimmerNode.export_load_options(), which already coverscube_elementsand everythingto_spectouchesTest Plan
make checkpassesmake testshows 100% unit test coverageDeployment Plan