-
Notifications
You must be signed in to change notification settings - Fork 177
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
Can't filter dbt nodes by tags when using LoadMode.CUSTOM #1367
Comments
Hey @yoshimaru46! 👋 I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together! To resolve the issue where the def _is_tags_subset(self, node: DbtNode) -> bool:
"""Checks if the node's tags are a subset of the config's tags."""
# Remove 'tags:' prefix from node tags if present
node_tags = [tag[len('tags:'):] if tag.startswith('tags:') else tag for tag in node.tags]
if not (set(self.config.tags) <= set(node_tags)):
return False
return True This modification ensures that the tags are compared correctly, allowing the subset check to function as intended [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Hey @yoshimaru46, would you like to submit a fix? |
PR: #1387 |
Please review this PR at your convenience 🙏 |
issue
when using
LoadMode.CUSTOM
, tags passed to DbtNode is prefixed withtags:
.astronomer-cosmos/cosmos/dbt/graph.py
Lines 656 to 666 in cfb6bf2
therefore,
_is_tags_subset
become always false.astronomer-cosmos/cosmos/dbt/selector.py
Line 388 in cfb6bf2
How to reproduce
model.sql
render_config
_is_tags_subset
set(["foo"])
set(["tags:foo"])
(set(self.config.tags) <= set(node.tags))
=> always falseThe text was updated successfully, but these errors were encountered: