-
Notifications
You must be signed in to change notification settings - Fork 14
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
Begin Validating Metric Names #184
Conversation
@Jstein77 It's worth noting that we may need some messaging around this as people could have specified invalid names in DSI 0.2.x (used by dbt-core 1.6.x). I've checked the fivetran dbt_add_reporting package, and it appears that this change won't cause any issues for that package. |
This is a stacked PR
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable! As discussed let's mark this as a breaking change.
@@ -0,0 +1,6 @@ | |||
kind: Fixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,6 @@ | |||
kind: Fixes | |||
body: Actually validate metric names like we say we do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicate it's a fix here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compied_manifest = deepcopy(simple_semantic_manifest__with_primary_transforms) | ||
semantic_model = compied_manifest.semantic_models[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: compied
-> copied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compied_manifest = deepcopy(simple_semantic_manifest__with_primary_transforms) | ||
metric = compied_manifest.metrics[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compied copied compied copied. 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebasing to fixup changes into relevant commits as noted in comments |
We used to have more types of top level objects, and we required uniqueness in their names across them. However the top level objects which required this are gone. Uniqueness is now only required for top level objects within their object type. This allows us to remove old logic and make the validating of semantic model names look the same as how we validate metric names. In our next commit, we'll abstract these duplicate implementations now that they look the same.
…er function We were doing a bunch of duplicate logic in `_validate_top_level_objects` that could be abstracted out. Unfortunately abstracting it out required generating the contexts for validatin issues in advance. It's not the prettiest, but it was necessary. Ideally the context building should happen in the helper method itself, however this isn't currently possible. We'd either need to have a generic context, be able to identify which context needs to be built, or have a generalized context class.
b99cc42
to
54a0648
Compare
Resolves #181
Description
We've been saying that we require metric names to match the regex (must start with a letter, must be lower case, can't contain dunders, and etc), but we haven't actually been validating this. This PR updates the
UniqueAndValidNameRule
to actually begin validating metric names. It's worth noting that we plan on backporting this to 0.3.latest as not validating the name doesn't cause issues in this repo, but will cause issues in the semantic layer.Checklist
changie new
to create a changelog entry