-
Notifications
You must be signed in to change notification settings - Fork 40
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
Releases/v0.12.latest #82
Changes from 11 commits
df5e496
89f0b09
f271d18
1baf570
946f7b4
7a4acbd
ea6bbb1
577d6dc
7bcf0de
c6a1690
67157bb
92a83ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# dbt_shopify v0.12.1 | ||
|
||
[PR #81](https://github.com/fivetran/dbt_shopify/pull/81) includes the following updates: | ||
|
||
## 🪲 Bug Fixes 🪛 | ||
- Added support for a new `delayed` fulfillment event status from Shopify. This produces a new `count_fulfillment_delayed` field in the `shopify__daily_shop` model. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd add your consistency/integrity tests as Under the Hood and that can be the #82 changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added! |
||
## Contributors | ||
- [@shreveasaurus](https://github.com/shreveasaurus) [PR #81](https://github.com/fivetran/dbt_shopify/pull/81) | ||
|
||
# dbt_shopify v0.12.0 | ||
|
||
[PR #76](https://github.com/fivetran/dbt_shopify/pull/76) includes the following updates: | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
id,_fivetran_synced,address_1,city,country,created_at,estimated_delivery_at,fulfillment_id,happened_at,latitude,longitude,message,order_id,province,shop_id,status,updated_at,zip,_fivetran_deleted | ||
451435,2022-11-18 04:39:07.945000,,,,2022-08-29 20:52:39.000000,,40495,2022-08-29 20:52:39.000000,,,,4502987,,89440612,delivered,2022-08-29 20:52:39.000000,,false | ||
48779,2022-11-18 05:48:01.773000,,LONDON,GB,2022-09-13 08:07:57.000000,,4064737,2022-08-15 12:41:00.000000,101.349998474121094,-14.0333000011742115,Delay,4588203,,320612,out_for_delivery,2022-09-13 08:07:57.000000,CR0,false | ||
1481515,2022-11-18 05:41:00.745000,,ECHO PARK,AU,2022-09-14 14:16:52.000000,2022-09-14 08:00:00.000000,4019339,2022-09-14 01:26:00.000000,-3.797698974609375,190.783958203125,Delay,451915,,89320612,out_for_delivery,2022-09-14 14:16:52.000000,2759,false | ||
1481515,2022-11-18 05:41:00.745000,,ECHO PARK,AU,2022-09-14 14:16:52.000000,2022-09-14 08:00:00.000000,4019339,2022-09-14 01:26:00.000000,-3.797698974609375,190.783958203125,Delay,451915,,89320612,delayed,2022-09-14 14:16:52.000000,2759,false | ||
558955,2022-11-18 10:51:24.286000,,LAZYTOWN,US,2022-08-13 12:40:26.000000,,402947,2022-03-01 10:36:39.000000,22.337699890136719,-71.731002807617188,Delay,429188587,MA,89420612,in_transit,2022-08-13 12:40:26.000000,01505,false | ||
6904235,2022-11-18 08:58:00.458000,,LA,US,2022-08-24 06:29:21.000000,2022-08-24 23:59:59.000000,4060491,2022-08-24 05:30:57.000000,12.287498474121094,-21.3573989868164,Delay,4242667,MA,89420612,in_transit,2022-08-24 06:29:21.000000,01760,false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
date_day, | ||
shop_id, | ||
source_relation, | ||
sum(count_orders) as count_orders, | ||
count(count_customers) as count_customers, | ||
sum(order_adjusted_total) as order_adjusted_total, | ||
sum(count_abandoned_checkouts) as count_abandoned_checkouts | ||
|
||
{% if var('shopify_using_fulfillment_event', false) %} | ||
, sum(count_fulfillment_attempted_delivery) as count_fulfillment_attempted_delivery | ||
, sum(count_fulfillment_confirmed) as count_fulfillment_confirmed | ||
, count(count_fulfillment_in_transit) as count_fulfillment_in_transit | ||
{% endif %} | ||
|
||
from {{ target.schema }}_shopify_prod.shopify__daily_shop | ||
group by 1,2,3 | ||
), | ||
|
||
dev as ( | ||
select | ||
date_day, | ||
shop_id, | ||
source_relation, | ||
sum(count_orders) as count_orders, | ||
count(count_customers) as count_customers, | ||
sum(order_adjusted_total) as order_adjusted_total, | ||
sum(count_abandoned_checkouts) as count_abandoned_checkouts | ||
|
||
{% if var('shopify_using_fulfillment_event', false) %} | ||
, sum(count_fulfillment_attempted_delivery) as count_fulfillment_attempted_delivery | ||
, sum(count_fulfillment_confirmed) as count_fulfillment_confirmed | ||
, count(count_fulfillment_in_transit) as count_fulfillment_in_transit | ||
{% endif %} | ||
|
||
from {{ target.schema }}_shopify_dev.shopify__daily_shop | ||
group by 1,2,3 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.date_day as prod_date_day, | ||
dev.date_day as dev_date_day, | ||
prod.shop_id as prod_shop_id, | ||
dev.shop_id as dev_shop_id, | ||
prod.source_relation as prod_source_relation, | ||
dev.source_relation as dev_source_relation, | ||
prod.count_orders as prod_count_orders, | ||
dev.count_orders as dev_count_orders, | ||
prod.count_customers as prod_count_customers, | ||
dev.count_customers as dev_count_customers, | ||
prod.order_adjusted_total as prod_order_adjusted_total, | ||
dev.order_adjusted_total as dev_order_adjusted_total, | ||
prod.count_abandoned_checkouts as prod_count_abandoned_checkouts, | ||
dev.count_abandoned_checkouts as dev_count_abandoned_checkouts | ||
|
||
{% if var('shopify_using_fulfillment_event', false) %} | ||
, prod.count_fulfillment_attempted_delivery as prod_count_fulfillment_attempted_delivery | ||
, dev.count_fulfillment_attempted_delivery as dev_count_fulfillment_attempted_delivery | ||
, prod.count_fulfillment_confirmed as prod_count_fulfillment_confirmed | ||
, dev.count_fulfillment_confirmed as dev_count_fulfillment_confirmed | ||
{% endif %} | ||
|
||
from prod | ||
full outer join dev | ||
on dev.date_day = prod.date_day | ||
and dev.shop_id = prod.shop_id | ||
and dev.source_relation = prod.source_relation | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
prod_date_day != dev_date_day or | ||
prod_shop_id != dev_shop_id or | ||
prod_source_relation != dev_source_relation or | ||
abs(prod_count_orders - dev_count_orders) > .001 or | ||
abs(prod_count_customers - dev_count_customers) > .001 or | ||
abs(prod_order_adjusted_total - dev_order_adjusted_total) > .001 or | ||
abs(prod_count_abandoned_checkouts - dev_count_abandoned_checkouts) > .001 | ||
|
||
{% if var('shopify_using_fulfillment_event', false) %} | ||
or abs(prod_count_fulfillment_attempted_delivery - dev_count_fulfillment_attempted_delivery) > .001 | ||
or abs(prod_count_fulfillment_confirmed - dev_count_fulfillment_confirmed) > .001 | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with orders as ( | ||
|
||
select * | ||
from {{ ref('shopify__orders') }} | ||
), | ||
|
||
order_metrics as ( | ||
|
||
select | ||
source_relation, | ||
cast({{ dbt.date_trunc('day','created_timestamp') }} as date) as date_day, | ||
count(distinct order_id) as count_orders, | ||
sum(order_adjusted_total) as order_adjusted_total | ||
|
||
from orders | ||
where created_timestamp > '2020-01-01' and created_timestamp < '2024-06-10' | ||
group by 1,2 | ||
), | ||
|
||
daily_shop as ( | ||
|
||
select * | ||
from {{ ref('shopify__daily_shop') }} | ||
), | ||
|
||
daily_shop_metrics as ( | ||
|
||
select | ||
source_relation, | ||
date_day, | ||
sum(count_orders) as count_orders, | ||
sum(order_adjusted_total) as order_adjusted_total | ||
|
||
from daily_shop | ||
where date_day >= '2020-01-01' and date_day < '2024-06-10' | ||
group by 1,2 | ||
), | ||
|
||
final as ( | ||
|
||
select | ||
daily_shop_metrics.source_relation, | ||
coalesce(daily_shop_metrics.count_orders, 0) as daily_shop_count_orders, | ||
coalesce(order_metrics.count_orders, 0) as order_count_orders, | ||
coalesce(daily_shop_metrics.order_adjusted_total, 0) as daily_shop_order_adjusted_total, | ||
coalesce(order_metrics.order_adjusted_total, 0) as order_order_adjusted_total | ||
|
||
from daily_shop_metrics | ||
full outer join order_metrics | ||
on daily_shop_metrics.source_relation = order_metrics.source_relation | ||
and daily_shop_metrics.date_day = order_metrics.date_day | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
abs(daily_shop_count_orders - order_count_orders) > 0 or | ||
abs(daily_shop_order_adjusted_total - order_order_adjusted_total) > .1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
-- test will only run if shopify_using_fulfillment_event is set to True | ||
|
||
with source as ( | ||
|
||
select * | ||
from {{ ref('stg_shopify__fulfillment_event') }} | ||
), | ||
|
||
source_metrics as ( | ||
|
||
select | ||
source_relation, | ||
cast({{ dbt.date_trunc('day','happened_at') }} as date) as date_day, | ||
shop_id, | ||
count(distinct case when status = 'delayed' then fulfillment_id end) as count_fulfillment_delayed, | ||
count(distinct case when status = 'in_transit' then fulfillment_id end) as count_fulfillment_in_transit, | ||
count(distinct case when status = 'confirmed' then fulfillment_id end) as count_fulfillment_confirmed, | ||
count(distinct case when status = 'delivered' then fulfillment_id end) as count_fulfillment_delivered | ||
|
||
from source | ||
where happened_at > '2020-01-01' and happened_at < '2024-06-10' | ||
group by 1,2,3 | ||
), | ||
|
||
model as ( | ||
|
||
select * | ||
from {{ ref('shopify__daily_shop') }} | ||
), | ||
|
||
model_metrics as ( | ||
|
||
select | ||
source_relation, | ||
date_day, | ||
shop_id, | ||
sum(count_fulfillment_delayed) as count_fulfillment_delayed, | ||
sum(count_fulfillment_in_transit) as count_fulfillment_in_transit, | ||
sum(count_fulfillment_confirmed) as count_fulfillment_confirmed, | ||
sum(count_fulfillment_delivered) as count_fulfillment_delivered | ||
|
||
from model | ||
where date_day >= '2020-01-01' and date_day < '2024-06-10' | ||
group by 1,2,3 | ||
), | ||
|
||
final as ( | ||
|
||
select | ||
model_metrics.source_relation, | ||
model_metrics.shop_id as model_shop_id, | ||
source_metrics.shop_id as source_shop_id, | ||
model_metrics.date_day as model_date_day, | ||
source_metrics.date_day as source_date_day, | ||
coalesce(model_metrics.count_fulfillment_delayed, 0) as model_count_fulfillment_delayed, | ||
coalesce(source_metrics.count_fulfillment_delayed, 0) as source_count_fulfillment_delayed, | ||
coalesce(model_metrics.count_fulfillment_in_transit, 0) as model_count_fulfillment_in_transit, | ||
coalesce(source_metrics.count_fulfillment_in_transit, 0) as source_count_fulfillment_in_transit, | ||
coalesce(model_metrics.count_fulfillment_confirmed, 0) as model_count_fulfillment_confirmed, | ||
coalesce(source_metrics.count_fulfillment_confirmed, 0) as source_count_fulfillment_confirmed, | ||
coalesce(model_metrics.count_fulfillment_delivered, 0) as model_count_fulfillment_delivered, | ||
coalesce(source_metrics.count_fulfillment_delivered, 0) as source_count_fulfillment_delivered | ||
|
||
from model_metrics | ||
full outer join source_metrics | ||
on model_metrics.source_relation = source_metrics.source_relation | ||
and model_metrics.shop_id = source_metrics.shop_id | ||
and model_metrics.date_day = source_metrics.date_day | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
model_count_fulfillment_delayed != source_count_fulfillment_delayed or | ||
model_count_fulfillment_in_transit != source_count_fulfillment_in_transit or | ||
model_count_fulfillment_confirmed != source_count_fulfillment_confirmed or | ||
model_count_fulfillment_delivered != source_count_fulfillment_delivered |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
packages: | ||
- package: fivetran/shopify_source | ||
version: [">=0.12.0", "<0.13.0"] | ||
version: [">=0.12.0", "<0.13.0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest PR is #82, so I'd change this from #81 to #82 or do what you did in the source package (call out the specific change that was applied in #81 on the bug fixes line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this line and added the PRs to the exact change line items