Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Typo in statically parsed ref unpacking #7365

Merged
merged 4 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230414-163642.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: fix typo in unpacking statically parsed ref
time: 2023-04-14T16:36:42.279838-04:00
custom:
Author: MichelleArk
Issue: "7364"
2 changes: 1 addition & 1 deletion core/dbt/parser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def populate(self, node: ModelNode, config: ContextConfig, statically_parsed: Di
if len(ref) == 1:
package, name = None, ref[0]
else:
package, name = ref[0], refs[1]
package, name = ref

refs.append(RefArgs(package=package, name=name))

Expand Down
31 changes: 31 additions & 0 deletions test/unit/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,37 @@ def test__two_models_simple_ref(self):
],
)

def test__two_models_package_ref(self):
self.use_models(
{
"model_one": "select * from events",
"model_two": "select * from {{ref('test_models_compile', 'model_one')}}",
}
)

config = self.get_config()
manifest = self.load_manifest(config)
compiler = self.get_compiler(config)
linker = compiler.compile(manifest)

self.assertCountEqual(
linker.nodes(),
[
"model.test_models_compile.model_one",
"model.test_models_compile.model_two",
],
)

self.assertCountEqual(
linker.edges(),
[
(
"model.test_models_compile.model_one",
"model.test_models_compile.model_two",
)
],
)

def test__model_materializations(self):
self.use_models(
{
Expand Down