From 53f1083cccca3bbfe6dd5d3fe701587ca7bd9fb6 Mon Sep 17 00:00:00 2001 From: yoshimaru46 Date: Fri, 13 Dec 2024 05:23:45 +0900 Subject: [PATCH] Remove "tags:" prefix from model config selectors --- cosmos/dbt/graph.py | 2 ++ tests/dbt/test_graph.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cosmos/dbt/graph.py b/cosmos/dbt/graph.py index be37ec298..0fcfc8c44 100644 --- a/cosmos/dbt/graph.py +++ b/cosmos/dbt/graph.py @@ -654,6 +654,8 @@ def load_via_custom_parser(self) -> None: for model_name, model in models: config = {item.split(":")[0]: item.split(":")[-1] for item in model.config.config_selectors} tags = [selector for selector in model.config.config_selectors if selector.startswith("tags:")] + # Remove the "tags:" prefix + tags = [tag.split(":")[-1] for tag in tags] node = DbtNode( unique_id=f"{model.type.value}.{self.project.project_name}.{model_name}", resource_type=DbtResourceType(model.type.value), diff --git a/tests/dbt/test_graph.py b/tests/dbt/test_graph.py index 59d71869d..37a581540 100644 --- a/tests/dbt/test_graph.py +++ b/tests/dbt/test_graph.py @@ -919,7 +919,7 @@ def test_load_via_load_via_custom_parser_select_rendering_config(): assert model_name == "customers" filter_node = dbt_graph.filtered_nodes.get(model_name) assert filter_node.file_path == DBT_PROJECTS_ROOT_DIR / "jaffle_shop/models/customers.sql" - assert filter_node.tags == ["tags:customers"] + assert filter_node.tags == ["customers"] @patch("cosmos.dbt.graph.DbtGraph.update_node_dependency", return_value=None)