fivetran / dbt_stripe

Data models for Stripe built using dbt.
https://fivetran.github.io/dbt_stripe/
Apache License 2.0
29 stars 33 forks source link

[Bug] balance_transactions test fail due to transactions with multiple disputes #87

Open bramrodenburg opened 1 week ago

bramrodenburg commented 1 week ago

Is there an existing issue for this?

Describe the issue

The balance transaction model assumes that a transaction can only have 1 dispute. This is not correct and leads to failing data tests due to a left join of the balance_transaction model with the disputes model.

Relevant error log or model output

15:14:14  Completed with 1 error and 0 warnings:
15:14:14  
15:14:14  Failure in test dbt_utils_unique_combination_of_columns_stripe__balance_transactions_balance_transaction_id__source_relation (models/stripe.yml)

Expected behavior

The tests don't fail and multiple disputes are properly handled within the balance_transactions model.

Possible solution

dbt Project configurations

n/a

Package versions

v0.14.0 dbt_stripe v0.12.0 dbt_stripe_source

What database are you using dbt with?

bigquery

How are you running this dbt package?

dbt Core™, dbt Cloud™

dbt Version

Core:

Plugins:

Additional Context

See Stripe docs here: https://support.stripe.com/questions/receiving-multiple-disputes-per-payment-faq

Are you willing to open a PR to help address this issue?

fivetran-joemarkiewicz commented 1 week ago

@bramrodenburg thanks for opening this issue and raising the multiple disputes possibility to our attention! I was not previously aware of this possibility and I can see how having multiple disputes with the current logic results in data validation test failures.

This is something we would like to consider folding into our package logic to account for these rare scenarios. I see you opened a PR 🎉! We really appreciate you being willing to contribute your code updates to the broader package for everyone. I will plan to move our conversation to the PR and will review the PR in more detail this week.

Thanks again!