-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Ct-65 metrics names with spaces #5173
Conversation
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. |
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.
LGTM
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.
Thanks for converting the test as well :)
@classmethod | ||
def validate(cls, data): | ||
super(UnparsedMetric, cls).validate(data) | ||
if "name" in data and " " in data["name"]: |
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.
In #4572, Joel offers:
- Motivation: Using metric names as column names. This will indeed vary by database!
- Expectation:
[_A-Za-z]
(I might say[a-z0-9_]
, as long as the numeric digit isn't first)
IMO spaces are the most disagreeable, even more than special characters. In any case, it looks like the logic here will be easy to extend if we decide to limit valid metric names to, e.g., alphanumeric characters and underscores. We'll want to incorporate opinions from the future maintainer(s) of the dbt-metrics
package. For now, I'm happy with what you've got here!
* Convert existing metrics test * add non-failing test for names with spaces * Raise ParsingException if metrics name contains spaces * Remove old metrics tests
resolves #4572
Description
Adds validation to UnparsedMetric class to ensure the metric name does not contain spaces
Checklist
changie new
to create a changelog entry