-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bugfix/union-data-type-comp * changelog not for test addition * pr reference update * schema change * docs regen * address review notes * validation variable documentation
- Loading branch information
1 parent
076757e
commit 241050f
Showing
13 changed files
with
142 additions
and
26 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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
packages: | ||
- local: ../ | ||
- local: ../ |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
recordkey,recordno,_fivetran_synced,accountkey,accountno,accounttitle,amount,basecurr,baselocation,classid,classname,currency,customerid,customername,departmentid,departmentname,entry_date,entrydescription,exchange_rate,itemid,itemname,line_no,lineitem,locationid,locationname,offsetglaccountno,offsetglaccounttitle,recordtype,state,totalpaid,totalselected,vendorid,vendorname,whencreated,whenmodified,warehouseid,warehousename | ||
195501,1807990,2021-12-23 23:26:30,450,18400,x/sa+CO+vXwLpWMgPddipQ==,350000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000432,x/sa+CO+vXwLpWMgPddipQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,350000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:03:30,2021-12-23 20:20:34,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195537,1808272,2021-12-23 23:26:30,450,18400,x/sa+CO+vXwLpWMgPddipQ==,500000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000432,x/sa+CO+vXwLpWMgPddipQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,500000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:41:25,2021-12-23 20:42:37,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195502,1807992,2021-12-23 23:26:30,93,18020,Vx/GvZdFq1acJ605gA97GA==,3500000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000006,dZ9+CHdAj4Ig231jX8axhQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,3500000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:07:33,2021-12-23 20:08:26,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195514,1808216,2021-12-23 23:26:30,97,18060,XM0crCkkb7/muKZqH9y8qA==,600000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000346,c/tQumxkKKj4XcjhJgUnBw==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,600000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:14:17,2021-12-23 20:18:45,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195523,1808236,2021-12-23 23:26:30,97,18060,XM0crCkkb7/muKZqH9y8qA==,200000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000750,0ldhgrdOiYUGk8/LN92u0A==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,200000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:24:20,2021-12-23 20:25:31,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195502,1807992,2021-12-23 23:26:30,93,18020-02,Vx/GvZdFq1acJ605gA97GA==,3500000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000006,dZ9+CHdAj4Ig231jX8axhQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,3500000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:07:33,2021-12-23 20:08:26,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195514,1808216,2021-12-23 23:26:30,97,18060-06,XM0crCkkb7/muKZqH9y8qA==,600000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000346,c/tQumxkKKj4XcjhJgUnBw==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,600000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:14:17,2021-12-23 20:18:45,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195523,1808236,2021-12-23 23:26:30,97,18060-06,XM0crCkkb7/muKZqH9y8qA==,200000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000750,0ldhgrdOiYUGk8/LN92u0A==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,200000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:24:20,2021-12-23 20:25:31,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195559,1808316,2021-12-23 23:26:30,119,18280,znZ4bC8qEj6RKzEj1Xy+ig==,400000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-001047,dh76crQJJOmFlnC1MMt27Q==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,400000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:52:21,2021-12-23 20:52:57,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195555,1808308,2021-12-23 23:26:30,430,18360,RwOn6ADDG3KXfV7ZDq6AoQ==,700000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000752,RwOn6ADDG3KXfV7ZDq6AoQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,700000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:51:08,2021-12-23 20:51:48,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195512,1808212,2021-12-23 23:26:30,98,18070,f2XQ+CC7HU1nELD66WnI0g==,300000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000304,p/9hRqTSIfa7o07f8nCxHw==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,300000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:12:09,2021-12-23 20:21:49,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195550,1808298,2021-12-23 23:26:30,424,18340,w66nRds5U9MA5A2Lb1FkzQ==,300000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-000368,EE+L99Wplte8kbgw+F5EJQ==,D-11000,YxGuF8HuUrNuaKr0rQZjhw==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,300000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:49:54,2021-12-23 20:50:39,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195547,1808292,2021-12-23 23:26:30,108,18170,U3hRRh4iCFBcoZW97enHqA==,300000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-001063,U3hRRh4iCFBcoZW97enHqA==,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,300000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:47:39,2021-12-23 20:49:11,,1B2M2Y8AsgTpgAmY7PhCfg== | ||
195547,1808292,2021-12-23 23:26:30,108,18170-17,U3hRRh4iCFBcoZW97enHqA==,300000,USD,124,,1B2M2Y8AsgTpgAmY7PhCfg==,USD,C-001063,U3hRRh4iCFBcoZW97enHqA==,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23,,1,,1B2M2Y8AsgTpgAmY7PhCfg==,1,TRUE,L-100,qFYGTc7Rk2KYsk4x06L/9g==,12000,lgzyYPEqhe0uNIe9CHj2NQ==,ri,A,300000,0,,1B2M2Y8AsgTpgAmY7PhCfg==,2021-12-23 20:47:39,2021-12-23 20:49:11,,1B2M2Y8AsgTpgAmY7PhCfg== |
52 changes: 52 additions & 0 deletions
52
integration_tests/tests/consistency/consistency_ap_ar_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,52 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
document_id, | ||
count(*) as row_count, | ||
sum(cast(amount as {{ dbt.type_numeric() }})) as initial_amount, | ||
sum(cast(total_paid as {{ dbt.type_numeric() }})) as total_amount_paid, | ||
sum(cast(total_due as {{ dbt.type_numeric() }})) as total_amount_due | ||
from {{ target.schema }}_sage_intacct_prod.sage_intacct__ap_ar_enhanced | ||
group by 1 | ||
), | ||
|
||
dev as ( | ||
select | ||
document_id, | ||
count(*) as row_count, | ||
sum(cast(amount as {{ dbt.type_numeric() }})) as initial_amount, | ||
sum(cast(total_paid as {{ dbt.type_numeric() }})) as total_amount_paid, | ||
sum(cast(total_due as {{ dbt.type_numeric() }})) as total_amount_due | ||
from {{ target.schema }}_sage_intacct_dev.sage_intacct__ap_ar_enhanced | ||
group by 1 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.document_id, | ||
prod.row_count as prod_row_count, | ||
dev.row_count as dev_row_count, | ||
round(prod.initial_amount, 2) as prod_initial_amount, | ||
round(dev.initial_amount, 2) as dev_initial_amount, | ||
round(prod.total_amount_paid, 2) as prod_total_amount_paid, | ||
round(dev.total_amount_paid, 2) as dev_total_amount_paid, | ||
round(prod.total_amount_due, 2) as prod_total_amount_due, | ||
round(dev.total_amount_due, 2) as dev_total_amount_due | ||
from prod | ||
full outer join dev | ||
on dev.document_id = prod.document_id | ||
) | ||
|
||
select * | ||
from final | ||
where (prod_row_count != dev_row_count | ||
or prod_initial_amount != dev_initial_amount | ||
or prod_total_amount_paid != dev_total_amount_paid | ||
or prod_total_amount_due != dev_total_amount_due | ||
) | ||
{{ "and document_id not in " ~ var('fivetran_consistency_ap_ar_enhanced_exclusion_documents',[]) ~ "" if var('fivetran_consistency_ap_ar_enhanced_exclusion_documents',[]) }} |
50 changes: 50 additions & 0 deletions
50
integration_tests/tests/integrity/ap_ar_enhanced_count_match.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,50 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- These validations are assuming the variables `sage_intacct__using_bills` and `sage_intacct__using_invoices` are set to `true`. | ||
|
||
with ap_source as ( | ||
select | ||
bill_id, | ||
count(*) as bill_row_count | ||
from {{ ref('stg_sage_intacct__ap_bill_item') }} | ||
group by 1 | ||
), | ||
|
||
ar_source as ( | ||
select | ||
invoice_id, | ||
count(*) as invoice_row_count | ||
from {{ ref('stg_sage_intacct__ar_invoice_item') }} | ||
group by 1 | ||
), | ||
|
||
ap_ar_enhanced as ( | ||
select | ||
document_id, | ||
document_type, | ||
count(*) as end_model_row_count | ||
from {{ ref('sage_intacct__ap_ar_enhanced') }} | ||
group by 1, 2 | ||
), | ||
|
||
match_check as ( | ||
select | ||
ap_ar_enhanced.document_id, | ||
ap_ar_enhanced.document_type, | ||
ap_ar_enhanced.end_model_row_count, | ||
case when ap_ar_enhanced.document_type = 'invoice' then ar_source.invoice_row_count else ap_source.bill_row_count end as source_row_count | ||
from ap_ar_enhanced | ||
full outer join ap_source | ||
on ap_ar_enhanced.document_id = ap_source.bill_id | ||
full outer join ar_source | ||
on ap_ar_enhanced.document_id = ar_source.invoice_id | ||
) | ||
|
||
select * | ||
from match_check | ||
where end_model_row_count != source_row_count | ||
{{ "and document_id not in " ~ var('fivetran_integrity_ap_ar_enhanced_exclusion_documents',[]) ~ "" if var('fivetran_integrity_ap_ar_enhanced_exclusion_documents',[]) }} |
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