dbt-core
dbt-core copied to clipboard
[Feature] Exposures: stricter validation for `name`, support custom `label`
Is this your first time submitting a feature request?
- [X] I have read the expectations for open source contributors
- [X] I have searched the existing issues, and I could not find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion
Describe the feature
Currently, it's possible to define an exposure like:
exposures:
- name: My Cool Exposure
...
A surprising number of things will keep working:
$ dbt list --resource-type exposure
exposure:my_project.My Cool Exposure
The problem is that it's not guaranteed to work everywhere. In particular, the dbt-docs
site DAG selection does not handle exposure names with spaces (https://github.com/dbt-labs/dbt-core/issues/2970).
Rather than fix it everywhere, I'd prefer to adopt the same approach we'll be taking for metrics (https://github.com/dbt-labs/dbt-core/issues/5456):
- Have stricter parse-time validation on the
name
property of exposures: snake-case, alphanumeric characters, maybe periods (since this is supported for models) - Support a
label
property that can be used in external metadata, and contain whatever characters the heart desires
exposures:
- name: my_cool_exposures
label: My Cool Exposure
...
Describe alternatives you've considered
- Continue to support whatever exposure names users want, and they only find out much later
- Add tons of strict validation without supporting a custom human-friendly
label
I don't like either very much!
Who will this benefit?
- Users of exposures
- Programmatic integrations with exposures (e.g. https://hightouch.com/blog/introducing-dbt-exposures-for-hightouch/)
Are you interested in contributing this feature?
Perhaps :)
Anything else?
No response