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

Invoice Line Item is not guaranteed to be unique #3

Closed kristin-bagnall closed 3 years ago

kristin-bagnall commented 3 years ago

https://github.com/fivetran/dbt_stripe/blob/d1ff90c165854fe7230397bafdcc5fb99d50db47/models/stripe.yml#L314

From customer: The stripe connector has ingested the data and I run the dbt job and get an error that the invoice line item id is not unique. I look at the data and, sure enough, it is not unique.

I email Stripe support. The long and the short of it is for invoice line items made before their 2019-12-03 API update the id field is not guaranteed to be unique. They told me that for items like this I really should be using the unique_id field for a unique id 🙄 .

This can be identified by the prefix on the id. If it is sli_ it is old and potentially not unique and should use the uniqueid field which is guaranteed unique and is prefixed with il.

I think this could be handled in the dbt module about how invoice_line_item_id is selected.

fivetran-joemarkiewicz commented 3 years ago

Addressed in PR #8