diff --git a/.changes/unreleased/Fixes-20230414-163642.yaml b/.changes/unreleased/Fixes-20230414-163642.yaml new file mode 100644 index 00000000000..7ba3cc58201 --- /dev/null +++ b/.changes/unreleased/Fixes-20230414-163642.yaml @@ -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" diff --git a/core/dbt/parser/models.py b/core/dbt/parser/models.py index 85fb233588a..1cd8c85579a 100644 --- a/core/dbt/parser/models.py +++ b/core/dbt/parser/models.py @@ -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)) diff --git a/test/unit/test_graph.py b/test/unit/test_graph.py index 47f09aed873..5bee5613236 100644 --- a/test/unit/test_graph.py +++ b/test/unit/test_graph.py @@ -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( {