Skip to content

Commit

Permalink
Add test for dedupe macro
Browse files Browse the repository at this point in the history
  • Loading branch information
judahrand committed Mar 6, 2022
1 parent ea38b6b commit 821c1d0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions integration_tests/data/sql/data_dedupe.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
user_id,event,version
1,play,1
1,play,2
2 changes: 2 additions & 0 deletions integration_tests/data/sql/data_dedupe_expected.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
user_id,event,version
1,play,2
9 changes: 7 additions & 2 deletions integration_tests/models/sql/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ models:
tests:
- dbt_utils.equality:
compare_model: ref('data_pivot_expected')

- name: test_pivot_apostrophe
tests:
- dbt_utils.equality:
Expand Down Expand Up @@ -137,8 +137,13 @@ models:
tests:
- dbt_utils.equality:
compare_model: ref('data_union_expected')

- name: test_get_relations_by_pattern
tests:
- dbt_utils.equality:
compare_model: ref('data_union_events_expected')

- name: test_dedupe
tests:
- dbt_utils.equality:
compare_model: ref('data_dedupe_expected')
7 changes: 7 additions & 0 deletions integration_tests/models/sql/test_dedupe.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WITH deduped as (

{{ dbt_utils.dedupe(ref('data_dedupe'), group_by='user_id', order_by='version desc') | indent }}

)

select * from deduped

0 comments on commit 821c1d0

Please sign in to comment.