Skip to content

Commit

Permalink
Bugfix/union data type comp (#22)
Browse files Browse the repository at this point in the history
* 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
fivetran-joemarkiewicz authored May 15, 2024
1 parent 076757e commit 241050f
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 26 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# dbt_sage_intacct v0.4.0
[PR #22](https://github.com/fivetran/dbt_sage_intacct/pull/22) includes the following updates.

## 🚨 Breaking Changes: Bug Fixes 🚨
- The `account_no` and `offset_gl_account_no` fields in the `sage_intacct__ap_ar_enhanced` end model are now consistently casted as strings using `{{ dbt.type_string() }}`. This ensures compatibility within the union all operation, preventing datatype conflicts between the fields within the upstream `invoice_item` and `bill_item` tables.

## Under the Hood
- Addition of integrity and consistency validation tests within integration tests for the `sage_intacct__ap_ar_enhanced` model.
- Updates to the `accountno` and `amount` seed datatypes within the integration tests to more closely resemble the datatype of those fields in the Sage Intacct connector.

# dbt_sage_intacct v0.3.0

[PR #19](https://github.com/fivetran/dbt_sage_intacct/pull/19) includes the following updates.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Include the following sage_intacct package version in your `packages.yml` file:
```yaml
packages:
- package: fivetran/sage_intacct
version: [">=0.3.0", "<0.4.0"] # we recommend using ranges to capture non-breaking changes automatically
version: [">=0.4.0", "<0.5.0"] # we recommend using ranges to capture non-breaking changes automatically
```

Do NOT include the `sage_intacct_source` package in this file. The transformation package itself has a dependency on it and will install the source package as well.
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'sage_intacct'
version: '0.3.0'
version: '0.4.0'
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
sage_intacct:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/run_results.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: sage_intacct_integration_tests_3
schema: sage_intacct_integration_tests_4
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: sage_intacct_integration_tests_3
schema: sage_intacct_integration_tests_4
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: sage_intacct_integration_tests_3
schema: sage_intacct_integration_tests_4
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: sage_intacct_integration_tests_3
schema: sage_intacct_integration_tests_4
threads: 8
databricks:
catalog: null
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: sage_intacct_integration_tests_3
schema: sage_intacct_integration_tests_4
threads: 2
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
18 changes: 11 additions & 7 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'sage_intacct_integration_tests'
version: '0.3.0'
version: '0.4.0'
config-version: 2

profile: 'integration_tests'
Expand All @@ -12,7 +12,16 @@ vars:
sage_intacct_ap_bill_item_identifier: "sage_intacct__ap_bill_item"
sage_intacct_ar_invoice_identifier: "sage_intacct__ar_invoice"
sage_intacct_ar_invoice_item_identifier: "sage_intacct__ar_invoice_item"
sage_intacct_schema: sage_intacct_integration_tests_3
sage_intacct_schema: sage_intacct_integration_tests_4

# ## For validation testing. To be commented out before release.
# sage_intacct_database: <see_corresponding_height_ticket>
# sage_intacct_schema: <see_corresponding_height_ticket>
# fivetran_consistency_ap_ar_enhanced_exclusion_documents: () ## -- Variable for filtering out documents if inconsistency is expected.
# fivetran_integrity_ap_ar_enhanced_exclusion_documents: () ## -- Variable for filtering out documents if inconsistency is expected.

models:
+schema: "sage_intacct_{{ var('directed_schema','dev') }}"

seeds:
+quote_columns: "{{ true if target.type == 'redshift' else false }}"
Expand All @@ -22,9 +31,7 @@ seeds:
recordkey: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
recordno: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
accountkey: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
accountno: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
accounttitle: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
amount: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
basecurr: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
baselocation: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
classid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
Expand All @@ -46,7 +53,6 @@ seeds:
offsetglaccounttitle: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
recordtype: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
state: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
totalpaid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
totalselected: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
vendorid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
vendorname: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
Expand All @@ -57,7 +63,6 @@ seeds:
accountkey: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
accountno: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
accounttitle: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
amount: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
basecurr: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
baselocation: "{{ 'int64' if target.name == 'bigquery' else 'bigint' }}"
classid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
Expand All @@ -80,7 +85,6 @@ seeds:
recordno: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
recordtype: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
state: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
totalpaid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
totalselected: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
vendorid: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
vendorname: "{{ 'varchar(100)' if target.name in ('redshift', 'postgres') else 'string' }}"
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
packages:
- local: ../
- local: ../
8 changes: 4 additions & 4 deletions integration_tests/seeds/sage_intacct__ar_invoice_item.csv
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 integration_tests/tests/consistency/consistency_ap_ar_enhanced.sql
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 integration_tests/tests/integrity/ap_ar_enhanced_count_match.sql
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',[]) }}
8 changes: 4 additions & 4 deletions models/sage_intacct__ap_ar_enhanced.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ap_bill_enhanced as (
ap_bill_item.bill_item_id,
cast(null as {{ dbt.type_string() }}) as invoice_id,
cast(null as {{ dbt.type_string() }}) as invoice_item_id,
ap_bill_item.account_no,
cast(ap_bill_item.account_no as {{ dbt.type_string() }}) as account_no,
ap_bill_item.account_title,
ap_bill_item.amount,
ap_bill_item.class_id,
Expand All @@ -53,7 +53,7 @@ ap_bill_enhanced as (
ap_bill_item.line_item,
ap_bill_item.location_id,
ap_bill_item.location_name,
ap_bill_item.offset_gl_account_no,
cast(ap_bill_item.offset_gl_account_no as {{ dbt.type_string() }}) as offset_gl_account_no,
ap_bill_item.offset_gl_account_title,
ap_bill_item.total_item_paid,
ap_bill_item.vendor_id,
Expand All @@ -80,7 +80,7 @@ ap_bill_enhanced as (
cast(null as {{ dbt.type_string() }}) as bill_item_id,
ar_invoice_item.invoice_id,
ar_invoice_item.invoice_item_id,
ar_invoice_item.account_no,
cast(ar_invoice_item.account_no as {{ dbt.type_string() }}) as account_no,
ar_invoice_item.account_title,
ar_invoice_item.amount,
ar_invoice_item.class_id,
Expand All @@ -98,7 +98,7 @@ ap_bill_enhanced as (
ar_invoice_item.line_item,
ar_invoice_item.location_id,
ar_invoice_item.location_name,
ar_invoice_item.offset_gl_account_no,
cast(ar_invoice_item.offset_gl_account_no as {{ dbt.type_string() }}) as offset_gl_account_no,
ar_invoice_item.offset_gl_account_title,
ar_invoice_item.total_item_paid,
ar_invoice_item.vendor_id,
Expand Down

0 comments on commit 241050f

Please sign in to comment.