-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from fivetran/feature/standardized-line-item-m…
…odel add line item standardized model
- Loading branch information
Showing
14 changed files
with
425 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
integration_tests/tests/consistency/consistency_line_item_enhanced.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select * | ||
from {{ target.schema }}_shopify_prod.shopify__line_item_enhanced | ||
), | ||
|
||
dev as ( | ||
select * | ||
from {{ target.schema }}_shopify_dev.shopify__line_item_enhanced | ||
), | ||
|
||
final as ( | ||
-- test will fail if any rows from prod are not found in dev | ||
(select * from prod | ||
except distinct | ||
select * from dev) | ||
|
||
union all -- union since we only care if rows are produced | ||
|
||
-- test will fail if any rows from dev are not found in prod | ||
(select * from dev | ||
except distinct | ||
select * from prod) | ||
) | ||
|
||
select * | ||
from final |
21 changes: 21 additions & 0 deletions
21
integration_tests/tests/consistency/consistency_line_item_enhanced_count.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test is to make sure the rows counts are the same between versions | ||
with prod as ( | ||
select count(*) as prod_rows | ||
from {{ target.schema }}_shopify_prod.shopify__line_item_enhanced | ||
), | ||
|
||
dev as ( | ||
select count(*) as dev_rows | ||
from {{ target.schema }}_shopify_dev.shopify__line_item_enhanced | ||
) | ||
|
||
-- test will return values and fail if the row counts don't match | ||
select * | ||
from prod | ||
join dev | ||
on prod.prod_rows != dev.dev_rows |
36 changes: 36 additions & 0 deletions
36
integration_tests/tests/integrity/vertical_integrity_line_item_enhanced.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test is to make sure there is no fanout between the staging order_line_table and the line_item_enhanced model. | ||
with stg_order_line as ( | ||
select | ||
1 as join_key, | ||
count(*) as order_line_count, | ||
count(distinct order_id) as order_count | ||
from {{ ref('stg_shopify__order_line') }} | ||
), | ||
|
||
line_item_enhanced as ( | ||
select | ||
1 as join_key, | ||
count(*) as line_item_enhanced_count | ||
from {{ ref('shopify__line_item_enhanced') }} | ||
), | ||
|
||
-- test will return values and fail if the row counts don't match | ||
|
||
final as ( | ||
select | ||
stg_order_line.join_key, | ||
stg_order_line.order_line_count + stg_order_line.order_count as total_line_and_order_count, | ||
line_item_enhanced.line_item_enhanced_count | ||
from stg_order_line | ||
join line_item_enhanced | ||
on stg_order_line.join_key = line_item_enhanced.join_key | ||
) | ||
|
||
select * | ||
from final | ||
where total_line_and_order_count != line_item_enhanced_count |
Oops, something went wrong.