Fix ORM over-hydration in namespace export + delete paths - #2435
Draft
shangyian wants to merge 2 commits into
Draft
Fix ORM over-hydration in namespace export + delete paths#2435shangyian wants to merge 2 commits into
shangyian wants to merge 2 commits into
Conversation
…ook paths
Three namespace-facing paths were pulling in ORM relationships their
consumers never touch:
- GET /namespaces/{namespace}/export/ hydrated materializations,
availability, and created_by for every node in the namespace via
NodeRevision.default_load_options(); the project-config builders only
read what NodeRevision.export_load_options() already loads (same slim
chain /export/spec uses).
- DELETE /namespaces/{namespace}/ and POST /namespaces/{namespace}/restore/
built full NodeMinimumDetail/Node objects (joinedload current +
selectinload tags) just to reduce them to node names; switched both to a
plain select(Node.name) via a new get_node_names_in_namespace helper.
- GET /datajunction-clients/python/notebook loaded the whole namespace (or
whole upstream graph for cube export) with default node-output options;
passed Node.export_load_options() explicitly since build_export_notebook
only needs parents (topological sort), dimension_links, and
columns/attributes -- per-node details are re-fetched individually by
python_client_create_node anyway.
✅ Deploy Preview for thriving-cassata-78ae72 canceled.
|
Add a test covering NodeNamespace.list_nodes' include_deactivated branch, which was only ever called with the default False value in production code, leaving the True path (and its untested else-branch skip) uncovered. Also remove get_nodes_in_namespace from internal/namespaces.py: after this branch's refactor to get_node_names_in_namespace, it had zero remaining callers, leaving its only statement permanently uncovered.
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
This reduces ORM over-hydration in three namespace-level paths:
GET /namespaces/{namespace}/export/hydrated materializations, availability, andcreated_byfor every node in the namespace viaNodeRevision.default_load_options(), but the project-config builders only read whatNodeRevision.export_load_options()already loads (this is the same trimmed down set that/export/specuses).DELETE /namespaces/{namespace}/andPOST /namespaces/{namespace}/restore/built fullNodeMinimumDetail/Nodeobjects just to reduce them to node names, so we can switch both to just select the node name.GET /datajunction-clients/python/notebookloaded the whole namespace (or whole upstream graph for cube export) with default node-output options. We can just useNode.export_load_options()instead sincebuild_export_notebookonly needs parents (topological sort),dimension_links, and columns/attributes. Per-node details are re-fetched individually bypython_client_create_nodeanyway.Test Plan
make checkpassesmake testshows 100% unit test coverageDeployment Plan