diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index dc2078a..8a20353 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,5 +1,5 @@ name: 'netsuite_integration_tests' -version: '0.14.0' +version: '0.15.0' profile: 'integration_tests' config-version: 2 diff --git a/integration_tests/tests/consistency/consistency_income_statement_amounts.sql b/integration_tests/tests/consistency/consistency_income_statement_amounts.sql new file mode 100644 index 0000000..9a08ea6 --- /dev/null +++ b/integration_tests/tests/consistency/consistency_income_statement_amounts.sql @@ -0,0 +1,37 @@ +{{ config( + tags="fivetran_validations", + enabled=var('fivetran_validation_tests_enabled', false) +) }} + +with prod as ( + select + accounting_period_id, + sum(converted_amount) as prod_converted_amount + from {{ target.schema }}_netsuite_prod.netsuite2__income_statement + where cast(accounting_period_ending as date) < current_date - 1 + group by 1 +), + +dev as ( + select + accounting_period_id, + sum(converted_amount) as dev_converted_amount + from {{ target.schema }}_netsuite_dev.netsuite2__income_statement + where cast(accounting_period_ending as date) < current_date - 1 + group by 1 +), + +final as ( + select + prod.accounting_period_id, + prod.prod_converted_amount, + dev.dev_converted_amount + from prod + full outer join dev + on dev.accounting_period_id = prod.accounting_period_id +) + + +select * +from final +where abs(prod_converted_amount - dev_converted_amount) >= 0.01 \ No newline at end of file