-
Notifications
You must be signed in to change notification settings - Fork 36
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] Divide by zero error - stripe__line_item_enhanced #86
Comments
Thanks for raising this issue @jjspratt! This is definitely something we can fix in the coming sprint (starting tomorrow). We have addressed this in the past by applying a
In this scenario it must be that the quantity is Thanks! |
@fivetran-joemarkiewicz there are not nulls in the table. There are rows where quantity is 0 due to various billing behaviors. For instance, it is not uncommon to see tiered pricing where the quantity is 0. There is also an outlier where both the amount and quantity were 0. This last one feels unintentional but it's also on a paid invoice and necessary for our reporting. The desired outcome for us would be that resulting unit amount were 0. |
Thanks for the clarification @jjspratt! So in the case you mentioned the expected cast(case when invoice_line_item.quantity = 0
then 0
else (invoice_line_item.amount/invoice_line_item.quantity)
end as {{ dbt.type_numeric() }}) as unit_amount, |
Hi @jjspratt, just wanted to let you know that we'll be moving forward with the above code change in the upcoming Stripe dbt package release. Our team will plan to integrate this change along with a few other outstanding dbt_stripe and dbt_stripe_source updates. You can expect to see us fold this in within the next two weeks. Thanks! |
My connector is running without issue now. Thank you so much. |
Excellent, I'll go ahead and close this out 😄 |
Is there an existing issue for this?
Describe the issue
When trying to enable this model I am hit with a divide by zero error. Looking at the table shows it's not uncommon for us to have an amount of 0 or a quantity of 0 on a line item.
I think this is due to tiered pricing but I haven't been able to validate this yet.
Relevant error log or model output
Expected behavior
The expected behavior is that the model either pass these rows with $0.00 for unit amount.
dbt Project configurations
vars:
stripe_schema: "fivetran_stripe"
stripe_transfer_identifier: fivetran_stripe.alt_stripe_transfers
stripe_account_identifier: account_filtered
stripe__using_credit_notes: True
stripe__standardized_billing_model_enabled: True
Package versions
0.14.0
What database are you using dbt with?
redshift
dbt Version
versionless
Additional Context
Thanks for all you do!
Are you willing to open a PR to help address this issue?
The text was updated successfully, but these errors were encountered: