Repository navigation
Conversation
…loom topologies; add test cases
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.
Hi @nicholasyager, I've encountered another issue related to circular topologies in loom for which I'm proposing a fix.
Problem
In circular loom topologies (e.g. project A references project B, and project B also
references project A), the upstream manifest contains a snapshot of the root project's
own nodes captured at publication time. When the root project compiles, dbt-loom
injects those stale nodes back into the graph.
If any of those nodes reference models that have since been disabled or deleted locally,
dbt raises:
Compilation Error
'model.project_a.some_model' depends on 'model.project_a.other_model'
which is not in the graph!
The existing
merge_loom_nodesdeduplication logic (introduced in #164) does notcover this case because the offending node's
package_namematches the root project,not a third package.
Root Cause
merge_loom_nodes(and thereforeinitialize()) had no guard preventing a projectfrom injecting nodes that belong to its own package. A transitive copy arriving via
an upstream manifest is by definition stale; the local project is always authoritative
for its own nodes.
Fix
Extended
merge_loom_nodeswith an optionalroot_project_nameparameter. Any nodewhose
package_name == root_project_nameis dropped before the authoritative-mergestep.
dbtLoom.initialize()passesself.project_namefor this parameter, so theguard is applied automatically for every manifest that is loaded.
No changes to the public API —
root_project_namedefaults toNone, preservingexisting behaviour when the parameter is not supplied.
Tests Added
tests/test_node_deduplication.py:test_root_project_nodes_are_not_reinjected— a stale self-owned node arriving viaan upstream manifest is not present in the merged result when
root_project_nameisset.
test_non_root_nodes_still_injected_when_root_project_name_set— settingroot_project_namedoes not prevent nodes from other packages from being injected.All six tests in the file pass.