Change union macro to not always include the _dbt_source_relation column
See original GitHub issueDescribe the feature
When developing, the _dbt_source_relation column from the union macro is useful to check that things are behaving properly, but once it’s all working properly I don’t like exposing implementation details to output models. I’d like to be able to opt out of that column being added at the front of my model.
Describe alternatives you’ve considered
- Adding another intermediary model which uses the star macro, passing the column into the
except
arg - Maintaining an internal copy of this macro
Who will this benefit?
Me! In this case, it’s a legacy hard-delete-finding snapshot using my snapshot-sandwich approach, and we’ve added another column but they’re out of order and don’t union nicely anymore.
Are you interested in contributing this feature?
Yes - I was planning to just wrap the cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }}
line in an {% if source_column_name %}
block, so you can pass None
in if you don’t want the column. Open to alternative approaches though (a new bool is more explicit, but getting towards a pretty unwieldy signature)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
@chloe-lubin thanks for suggesting this! Could I ask you to open a new issue so that it can be prioritised/discovered separately to this one?
Resolved by #624