feat: add config.tags and +tags support for metrics#12604
Open
dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
Open
feat: add config.tags and +tags support for metrics#12604dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
dtaniwaki wants to merge 1 commit intodbt-labs:mainfrom
Conversation
33a7066 to
e515af0
Compare
Contributor
|
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
518c38d to
38b37eb
Compare
38b37eb to
e4276b2
Compare
Contributor
Additional Artifact Review RequiredChanges to artifact directory files requires at least 2 approvals from core team members. |
5e2d95e to
9ec89fb
Compare
2 tasks
9ec89fb to
a0b27bc
Compare
Signed-off-by: Daisuke Taniwaki <daisuketaniwaki@gmail.com>
a0b27bc to
0517ca5
Compare
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.
Resolves #12607
Thanks for maintaining dbt-core! I'd appreciate your review on this PR.
Problem
Metrics do not support
config.tagsin YAML or+tagsindbt_project.yml. There is no way to apply tags to metrics through the standard config system, making it inconsistent with other resource types.Additionally, v1 metrics had a top-level
tags:field that was silently applied to the node outside of the config system, which is inconsistent with how other resource types handle tags.Solution
Add
tagstoMetricConfigusingMergeBehavior.Append, so tags fromdbt_project.yml(+tags) and fromconfig.tagsin YAML are merged, deduplicated, and sorted.YAML config block:
dbt_project.yml:Top-level
tags:on v1 metrics (outside of aconfig:block) now emit aValidationWarningdirecting users to useconfig.tagsinstead, since metrics implement tags via the config system only.A
normalize_tags()helper is introduced inparser/common.pyto deduplicate and sort tags consistently, and is reused acrossExposureParser,MetricParser, andSavedQueryParser.Checklist