Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 4 tasks
bramrodenburg opened this issue Sep 9, 2024 · 2 comments
Closed
2 of 4 tasks
Assignees
Labels
error:forced status:in_progress Currently being worked on type:bug Something is broken or incorrect

Comments

@bramrodenburg
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

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

  • Aggregate the dispute_ids and dispute reasons in an array within the balance_transactions table.
  • Sum the dispute_amount?

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:

  • installed: 1.8.1
  • latest: 1.8.6 - Update available!

Your version of dbt-core is out of date!
You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:

  • bigquery: 1.8.1 - Update available!

At least one plugin is out of date or incompatible with dbt-core.
You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

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?

  • Yes.
  • Yes, but I will need assistance.
  • No.
@bramrodenburg bramrodenburg added the type:bug Something is broken or incorrect label Sep 9, 2024
@bramrodenburg bramrodenburg changed the title [Bug] Cannot handle balance transactions with multiple disputs [Bug] Cannot handle balance transactions with multiple disputes Sep 9, 2024
@bramrodenburg bramrodenburg changed the title [Bug] Cannot handle balance transactions with multiple disputes [Bug] balance_transactions test fail due to transactions with multiple disputes Sep 9, 2024
@fivetran-joemarkiewicz
Copy link
Contributor

@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!

@fivetran-joemarkiewicz
Copy link
Contributor

Closing this issue as it has been addressed in the above PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error:forced status:in_progress Currently being worked on type:bug Something is broken or incorrect
Projects
None yet
Development

No branches or pull requests

3 participants