fivetran / dbt_shopify

Fivetran's Shopify dbt package
https://fivetran.github.io/dbt_shopify/
Apache License 2.0
55 stars 41 forks source link

Filter out orders without a customer_id in order aggregates by customer #11

Closed MartinGuindon closed 3 years ago

MartinGuindon commented 3 years ago

It's possible in Shopify to have orders that are not associated with a customer, depending on the shop configuration or the way the order has been entered in the system (such as using drafts or other channels).

I have occurrences of this in the project I'm working on right now. The shopify__customers__order_aggregates model currently assumes that all orders have a customer_id, and tests for not_null on that field, and therefore fails on my project.

Since this model is aggregating by customer, I've modified it to add a where clause, filtering out orders that are not associated to a customer.