-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continuation of #88 - handle multiple disputes in stripe__balance_tra…
…nsactions (#92) * fix!: handle multiple disputes (#88) * Documentation Standard Updates (#85) * MagicBot/documentation-updates * Apply suggestions from code review * Apply suggestions from code review --------- Co-authored-by: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com> * fix!: handle multiple disputes * replace array_agg with string_agg * update changelog * bump version --------- Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Co-authored-by: Jamie Rodriguez <65564846+fivetran-jamie@users.noreply.github.com> * changes * aws and changelog * validations * Update models/stripe__balance_transactions.sql Co-authored-by: Renee Li <91097070+fivetran-reneeli@users.noreply.github.com> * renee feedback * docs * update package ref * changelog --------- Co-authored-by: bramrodenburg <14278376+bramrodenburg@users.noreply.github.com> Co-authored-by: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Co-authored-by: Renee Li <91097070+fivetran-reneeli@users.noreply.github.com>
- Loading branch information
1 parent
fff4235
commit 7cfdfc5
Showing
17 changed files
with
248 additions
and
29 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
integration_tests/tests/consistency/consistency_activity_itemized_2.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,21 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select balance_transaction_id, dispute_id as dispute_ids -- we don't have multi-dispute records in our data | ||
from {{ target.schema }}_stripe_prod.stripe__activity_itemized_2 | ||
), | ||
|
||
dev as ( | ||
select balance_transaction_id, dispute_ids | ||
from {{ target.schema }}_stripe_dev.stripe__activity_itemized_2 | ||
) | ||
|
||
-- test will return values and fail if the values are different (which they shouldn't be in our test data) | ||
select * | ||
from prod | ||
join dev | ||
on prod.balance_transaction_id = dev.balance_transaction_id | ||
where prod.dispute_ids != dev.dispute_ids |
21 changes: 21 additions & 0 deletions
21
integration_tests/tests/consistency/consistency_balance_change_from_activity_itemized_3.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,21 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select balance_transaction_id, dispute_reason as dispute_reasons -- we don't have multi-dispute records in our data | ||
from {{ target.schema }}_stripe_prod.stripe__balance_change_from_activity_itemized_3 | ||
), | ||
|
||
dev as ( | ||
select balance_transaction_id, dispute_reasons | ||
from {{ target.schema }}_stripe_dev.stripe__balance_change_from_activity_itemized_3 | ||
) | ||
|
||
-- test will return values and fail if the values are different (which they shouldn't be in our test data) | ||
select * | ||
from prod | ||
join dev | ||
on prod.balance_transaction_id = dev.balance_transaction_id | ||
where prod.dispute_reasons != dev.dispute_reasons |
32 changes: 32 additions & 0 deletions
32
integration_tests/tests/consistency/consistency_balance_transcations_count.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,32 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test is to make sure the rows counts are the same between versions | ||
with prod as ( | ||
select | ||
count(*) as prod_rows, | ||
sum(customer_facing_amount) as customer_facing_amount, | ||
sum(balance_transaction_amount) as balance_transaction_amount, | ||
sum(balance_transaction_net) as balance_transaction_net | ||
from {{ target.schema }}_stripe_prod.stripe__balance_transactions | ||
), | ||
|
||
dev as ( | ||
select | ||
count(*) as dev_rows, | ||
sum(customer_facing_amount) as customer_facing_amount, | ||
sum(balance_transaction_amount) as balance_transaction_amount, | ||
sum(balance_transaction_net) as balance_transaction_net | ||
from {{ target.schema }}_stripe_dev.stripe__balance_transactions | ||
) | ||
|
||
-- test will return values and fail if the row counts don't match | ||
select * | ||
from prod | ||
join dev | ||
on prod.prod_rows != dev.dev_rows | ||
or prod.customer_facing_amount != dev.customer_facing_amount | ||
or prod.balance_transaction_amount != dev.balance_transaction_amount | ||
or prod.balance_transaction_net != dev.balance_transaction_net |
21 changes: 21 additions & 0 deletions
21
...on_tests/tests/consistency/consistency_ending_balance_reconciliation_itemized_4_count.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,21 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select balance_transaction_id, dispute_reason as dispute_reasons -- we don't have multi-dispute records in our data | ||
from {{ target.schema }}_stripe_prod.stripe__ending_balance_reconciliation_itemized_4 | ||
), | ||
|
||
dev as ( | ||
select balance_transaction_id, dispute_reasons | ||
from {{ target.schema }}_stripe_dev.stripe__ending_balance_reconciliation_itemized_4 | ||
) | ||
|
||
-- test will return values and fail if the values are different (which they shouldn't be in our test data) | ||
select * | ||
from prod | ||
join dev | ||
on prod.balance_transaction_id = dev.balance_transaction_id | ||
where prod.dispute_reasons != dev.dispute_reasons |
27 changes: 27 additions & 0 deletions
27
integration_tests/tests/integrity/integrity_balance_transactions.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,27 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with staging_model as ( | ||
select | ||
count(*) as row_count, | ||
sum(amount) as balance_transaction_amount, | ||
sum(net) as balance_transaction_net | ||
from {{ ref('stg_stripe__balance_transaction') }} | ||
), | ||
|
||
end_model as ( | ||
select | ||
count(*) as row_count, | ||
sum(balance_transaction_amount) as balance_transaction_amount, | ||
sum(balance_transaction_net) as balance_transaction_net | ||
from {{ ref('stripe__balance_transactions') }} | ||
) | ||
|
||
select * | ||
from staging_model | ||
join end_model | ||
on staging_model.row_count != end_model.row_count | ||
or staging_model.balance_transaction_amount != end_model.balance_transaction_amount | ||
or staging_model.balance_transaction_net != end_model.balance_transaction_net |
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
Oops, something went wrong.