-
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.
Merge pull request #24 from fivetran/bugfix/datespine-timestamp-error
Bug Fix: Date spine timestamp error
- Loading branch information
Showing
12 changed files
with
190 additions
and
50 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
48 changes: 48 additions & 0 deletions
48
integration_tests/tests/consistency/consistency_general_ledger.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,48 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test ensures the general ledger end model matches the prior version | ||
with prod as ( | ||
select * | ||
from {{ target.schema }}_sage_intacct_prod.sage_intacct__general_ledger | ||
where date(entry_date_at) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
dev as ( | ||
select * | ||
from {{ target.schema }}_sage_intacct_dev.sage_intacct__general_ledger | ||
where date(entry_date_at) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
prod_not_in_dev as ( | ||
-- rows from prod not found in dev | ||
select * from prod | ||
except distinct | ||
select * from dev | ||
), | ||
|
||
dev_not_in_prod as ( | ||
-- rows from dev not found in prod | ||
select * from dev | ||
except distinct | ||
select * from prod | ||
), | ||
|
||
final as ( | ||
select | ||
*, | ||
'from prod' as source | ||
from prod_not_in_dev | ||
|
||
union all -- union since we only care if rows are produced | ||
|
||
select | ||
*, | ||
'from dev' as source | ||
from dev_not_in_prod | ||
) | ||
|
||
select * | ||
from final |
48 changes: 48 additions & 0 deletions
48
integration_tests/tests/consistency/consistency_general_ledger_by_period.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,48 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test ensures the general ledger end model matches the prior version | ||
with prod as ( | ||
select * | ||
from {{ target.schema }}_sage_intacct_prod.sage_intacct__general_ledger_by_period | ||
where date(period_last_day) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
dev as ( | ||
select * | ||
from {{ target.schema }}_sage_intacct_dev.sage_intacct__general_ledger_by_period | ||
where date(period_last_day) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
prod_not_in_dev as ( | ||
-- rows from prod not found in dev | ||
select * from prod | ||
except distinct | ||
select * from dev | ||
), | ||
|
||
dev_not_in_prod as ( | ||
-- rows from dev not found in prod | ||
select * from dev | ||
except distinct | ||
select * from prod | ||
), | ||
|
||
final as ( | ||
select | ||
*, | ||
'from prod' as source | ||
from prod_not_in_dev | ||
|
||
union all -- union since we only care if rows are produced | ||
|
||
select | ||
*, | ||
'from dev' as source | ||
from dev_not_in_prod | ||
) | ||
|
||
select * | ||
from final |
24 changes: 24 additions & 0 deletions
24
integration_tests/tests/integrity/integrity_general_ledger_by_period.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,24 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
-- this test is to make sure there is no fanout between the spine and the general_ledger_by_period | ||
|
||
with spine as ( | ||
|
||
select count(*) as spine_count | ||
from {{ ref('int_sage_intacct__general_ledger_date_spine') }} | ||
), | ||
|
||
general_ledger_by_period as ( | ||
|
||
select count(*) as glp_count | ||
from {{ ref('sage_intacct__general_ledger_by_period') }} | ||
) | ||
|
||
-- test will return values and fail if the row counts don't match | ||
select * | ||
from spine | ||
join general_ledger_by_period | ||
on spine.spine_count != general_ledger_by_period.glp_count |
59 changes: 26 additions & 33 deletions
59
models/intermediate/int_sage_intacct__general_ledger_date_spine.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