-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/databricks-delta-incremental-support (#130)
* feature/databricks-delta-incremental-support * changelog and integration test updates * pre review modifications * Update consistency__audit_table.sql * Apply suggestions from code review Co-authored-by: Avinash Kunnath <[email protected]> * changelog, readme, and docs rebuild updates * Apply suggestions from code review Co-authored-by: Avinash Kunnath <[email protected]> * macro updates for full coverage * removed artifacts * schema change and CHANGELOG edit * added supported destinations to elif and docs regen * Update is_incremental_compatible.sql --------- Co-authored-by: Avinash Kunnath <[email protected]>
- Loading branch information
1 parent
5fef364
commit ce41a02
Showing
26 changed files
with
701 additions
and
31 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,3 +1,2 @@ | ||
|
||
packages: | ||
- local: ../ | ||
- local: ../ |
67 changes: 67 additions & 0 deletions
67
integration_tests/tests/consistency/consistency__audit_table.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,67 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
connector_id, | ||
table_name, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_prod.fivetran_platform__audit_table | ||
group by 1, 2 | ||
), | ||
|
||
dev as ( | ||
select | ||
connector_id, | ||
table_name, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_dev.fivetran_platform__audit_table | ||
group by 1, 2 | ||
), | ||
|
||
final_consistency_check as ( | ||
select | ||
prod.connector_id, | ||
prod.table_name, | ||
prod.total_records as prod_total, | ||
dev.total_records as dev_total | ||
from prod | ||
left join dev | ||
on dev.connector_id = prod.connector_id | ||
and dev.table_name = prod.table_name | ||
), | ||
|
||
-- Checking to ensure the dev totals match the prod totals | ||
consistency_check as ( | ||
select * | ||
from final_consistency_check | ||
where prod_total != dev_total | ||
), | ||
|
||
-- For use when the current release changes the row count of the audit table model intentionally. | ||
-- The below queries prove the records that do not match are still accurate by checking the source. | ||
verification_staging_setup as ( | ||
select | ||
connector_id, | ||
{{ fivetran_log.fivetran_log_json_parse(string='message_data', string_path=['table']) }} as table_name, | ||
count(*) as row_count | ||
from {{ target.schema }}_fivetran_platform_dev.stg_fivetran_platform__log | ||
where event_subtype in ('write_to_table_start') | ||
group by 1, 2 | ||
), | ||
|
||
final_verification as ( | ||
select * | ||
from consistency_check | ||
left join verification_staging_setup | ||
on consistency_check.connector_id = verification_staging_setup.connector_id | ||
and consistency_check.table_name = verification_staging_setup.table_name | ||
where consistency_check.dev_total != verification_staging_setup.row_count | ||
) | ||
|
||
select * | ||
from final_verification | ||
|
43 changes: 43 additions & 0 deletions
43
integration_tests/tests/consistency/consistency__audit_user_activity.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,43 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
connector_id, | ||
email, | ||
date_day, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_prod.fivetran_platform__audit_user_activity | ||
group by 1, 2, 3 | ||
), | ||
|
||
dev as ( | ||
select | ||
connector_id, | ||
email, | ||
date_day, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_dev.fivetran_platform__audit_user_activity | ||
group by 1, 2, 3 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.connector_id, | ||
prod.email, | ||
prod.date_day, | ||
prod.total_records as prod_total, | ||
dev.total_records as dev_total | ||
from prod | ||
left join dev | ||
on dev.connector_id = prod.connector_id | ||
and dev.email = prod.email | ||
and dev.date_day = prod.date_day | ||
) | ||
|
||
select * | ||
from final | ||
where prod_total != dev_total |
43 changes: 43 additions & 0 deletions
43
integration_tests/tests/consistency/consistency__connector_daily_events.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,43 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
date_day, | ||
connector_id, | ||
destination_id, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_prod.fivetran_platform__connector_daily_events | ||
group by 1, 2, 3 | ||
), | ||
|
||
dev as ( | ||
select | ||
date_day, | ||
connector_id, | ||
destination_id, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_dev.fivetran_platform__connector_daily_events | ||
group by 1, 2, 3 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.date_day, | ||
prod.connector_id, | ||
prod.destination_id, | ||
prod.total_records as prod_total, | ||
dev.total_records as dev_total | ||
from prod | ||
left join dev | ||
on dev.date_day = prod.date_day | ||
and dev.connector_id = prod.connector_id | ||
and dev.destination_id = prod.destination_id | ||
) | ||
|
||
select * | ||
from final | ||
where prod_total != dev_total |
41 changes: 41 additions & 0 deletions
41
integration_tests/tests/consistency/consistency__connector_status.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,41 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_records, | ||
sum(number_of_schema_changes_last_month) as total_schema_changes_last_month | ||
from {{ target.schema }}_fivetran_platform_prod.fivetran_platform__connector_status | ||
group by 1 | ||
), | ||
|
||
dev as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_records, | ||
sum(number_of_schema_changes_last_month) as total_schema_changes_last_month | ||
from {{ target.schema }}_fivetran_platform_dev.fivetran_platform__connector_status | ||
group by 1 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.join_key, | ||
dev.join_key, | ||
prod.total_records as prod_total, | ||
dev.total_records as dev_total, | ||
prod.total_schema_changes_last_month as prod_total_schema_changes, | ||
dev.total_schema_changes_last_month as dev_total_schema_changes | ||
from prod | ||
left join dev | ||
on dev.join_key = prod.join_key | ||
) | ||
|
||
select * | ||
from final | ||
where prod_total != dev_total | ||
or prod_total_schema_changes != dev_total_schema_changes |
56 changes: 56 additions & 0 deletions
56
integration_tests/tests/consistency/consistency__mar_table_history.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,56 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
connector_name, | ||
schema_name, | ||
table_name, | ||
destination_id, | ||
measured_month, | ||
sum(total_monthly_active_rows) as total_mar, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_prod.fivetran_platform__mar_table_history | ||
group by 1, 2, 3, 4, 5 | ||
), | ||
|
||
dev as ( | ||
select | ||
connector_name, | ||
schema_name, | ||
table_name, | ||
destination_id, | ||
measured_month, | ||
sum(total_monthly_active_rows) as total_mar, | ||
count(*) as total_records | ||
from {{ target.schema }}_fivetran_platform_dev.fivetran_platform__mar_table_history | ||
group by 1, 2, 3, 4, 5 | ||
), | ||
|
||
final as ( | ||
select | ||
prod.connector_name, | ||
prod.schema_name, | ||
prod.table_name, | ||
prod.destination_id, | ||
prod.measured_month, | ||
prod.total_records as prod_total, | ||
dev.total_records as dev_total, | ||
prod.total_mar as prod_total_mar, | ||
dev.total_mar as dev_total_mar | ||
from prod | ||
left join dev | ||
on dev.connector_name = prod.connector_name | ||
and dev.schema_name = prod.schema_name | ||
and dev.table_name = prod.table_name | ||
and dev.destination_id = prod.destination_id | ||
and dev.measured_month = prod.measured_month | ||
) | ||
|
||
select * | ||
from final | ||
where prod_total != dev_total | ||
or prod_total_mar != dev_total_mar |
Oops, something went wrong.