-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
deduplicate()
arguments (#548)
* Add Postgres specific `deduplicate` implementation * Add Snowflake specific `deduplicate` implementation * Remove subquery to improve readability * Remove use of `dbt_utils.star` in `deduplicate` * Make sure Redshift uses default implementation * Improve `deduplicate` documentation * Use `natural join` to avoid having to parse expressions * Remove `relation_alias` argument * Rename `group_by` to `partition_by` * Update docs for `deduplicate()` * Add note about potential nondeterminism * Allow usage of deprecated args with warnings * Fix BigQuery name collision * Update CHANGELOG.md
- Loading branch information
Showing
6 changed files
with
184 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
integration_tests/models/sql/test_deduplicate_deprecated.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
with | ||
|
||
source as ( | ||
select * | ||
from {{ ref('data_deduplicate') }} | ||
where user_id = 1 | ||
), | ||
|
||
deduped as ( | ||
|
||
{{ | ||
dbt_utils.deduplicate( | ||
ref('data_deduplicate'), | ||
group_by='user_id', | ||
order_by='version desc', | ||
relation_alias='source', | ||
) | indent | ||
}} | ||
|
||
) | ||
|
||
select * from deduped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters