Parameterize union_relations macro to support deduplication with UNION
- Dominant language
- Makefile
- Stars
- 1.8k
- Forks
- 632
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature
By default, the `union_relations` macro performs a `UNION ALL`. However, I think the macro should also support deduplication of rows using `UNION`
https://github.com/dbt-labs/dbt-utils/blob/a17d66f332a782a7e81a59f8d249237f3c29612c/macros/sql/union.sql#L1
### Describe alternatives you've considered
Users could perform a `SELECT DISTINCT *` after the `UNION ALL` in their model which would achieve the same functionality. However, I think it more ideal to include the option as a parameter since it is supported by SQL.
### Additional context
N/A
### Who will this benefit?
While it is better practice to dedupe in staging models, teams may want to use a quick `UNION` for prototyping non-productionized code.
### Are you interested in contributing this feature?
Yes! I would be happy to make a PR with the change and associated tests.
```[tasklist]
### Tasks
```
Contributor guide
Assessment
This issue has not been assessed yet.