-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50edc38
commit 677985c
Showing
5 changed files
with
444 additions
and
0 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
integration_tests/tests/consistency/consistency_account_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,73 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
source_relation, | ||
account_id, | ||
_fivetran_synced, | ||
account_name, | ||
account_status, | ||
business_country_code, | ||
created_at, | ||
currency, | ||
timezone_name | ||
from {{ target.schema }}_facebook_ads_source_prod.stg_facebook_ads__account_history | ||
where is_most_recent_record | ||
), | ||
|
||
dev as ( | ||
select | ||
source_relation, | ||
account_id, | ||
_fivetran_synced, | ||
account_name, | ||
account_status, | ||
business_country_code, | ||
created_at, | ||
currency, | ||
timezone_name | ||
from {{ target.schema }}_facebook_ads_source_dev.stg_facebook_ads__account_history | ||
where is_most_recent_record | ||
), | ||
|
||
final as ( | ||
select | ||
dev.source_relation as dev_source_relation, | ||
prod.source_relation as prod_source_relation, | ||
dev.account_id as dev_account_id, | ||
prod.account_id as prod_account_id, | ||
dev._fivetran_synced as dev__fivetran_synced, | ||
prod._fivetran_synced as prod__fivetran_synced, | ||
dev.account_name as dev_account_name, | ||
prod.account_name as prod_account_name, | ||
dev.account_status as dev_account_status, | ||
prod.account_status as prod_account_status, | ||
dev.business_country_code as dev_business_country_code, | ||
prod.business_country_code as prod_business_country_code, | ||
dev.created_at as dev_created_at, | ||
prod.created_at as prod_created_at, | ||
dev.currency as dev_currency, | ||
prod.currency as prod_currency, | ||
dev.timezone_name as dev_timezone_name, | ||
prod.timezone_name as prod_timezone_name | ||
|
||
from prod | ||
full outer join dev | ||
on dev.account_id = prod.account_id | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
prod_source_relation != dev_source_relation | ||
or prod_account_id != dev_account_id | ||
or prod__fivetran_synced != dev__fivetran_synced | ||
or prod_account_name != dev_account_name | ||
or prod_account_status != dev_account_status | ||
or prod_business_country_code != dev_business_country_code | ||
or prod_created_at != dev_created_at | ||
or prod_currency != dev_currency | ||
or prod_timezone_name != dev_timezone_name |
68 changes: 68 additions & 0 deletions
68
integration_tests/tests/consistency/consistency_ad_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,68 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
ad_id, | ||
ad_name, | ||
account_id, | ||
ad_set_id, | ||
campaign_id, | ||
creative_id | ||
from {{ target.schema }}_facebook_ads_source_prod.stg_facebook_ads__ad_history | ||
where is_most_recent_record | ||
), | ||
|
||
dev as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
ad_id, | ||
ad_name, | ||
account_id, | ||
ad_set_id, | ||
campaign_id, | ||
creative_id | ||
from {{ target.schema }}_facebook_ads_source_dev.stg_facebook_ads__ad_history | ||
where is_most_recent_record | ||
), | ||
|
||
final as ( | ||
select | ||
dev.source_relation as dev_source_relation, | ||
prod.source_relation as prod_source_relation, | ||
dev.updated_at as dev_updated_at, | ||
prod.updated_at as prod_updated_at, | ||
dev.ad_id as dev_ad_id, | ||
prod.ad_id as prod_ad_id, | ||
dev.ad_name as dev_ad_name, | ||
prod.ad_name as prod_ad_name, | ||
dev.account_id as dev_account_id, | ||
prod.account_id as prod_account_id, | ||
dev.ad_set_id as dev_ad_set_id, | ||
prod.ad_set_id as prod_ad_set_id, | ||
dev.campaign_id as dev_campaign_id, | ||
prod.campaign_id as prod_campaign_id, | ||
dev.creative_id as dev_creative_id, | ||
prod.creative_id as prod_creative_id | ||
|
||
from prod | ||
full outer join dev | ||
on dev.ad_id = prod.ad_id | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
prod_source_relation != dev_source_relation | ||
or prod_updated_at != dev_updated_at | ||
or prod_ad_id != dev_ad_id | ||
or prod_ad_name != dev_ad_name | ||
or prod_account_id != dev_account_id | ||
or prod_ad_set_id != dev_ad_set_id | ||
or prod_campaign_id != dev_campaign_id | ||
or prod_creative_id != dev_creative_id |
88 changes: 88 additions & 0 deletions
88
integration_tests/tests/consistency/consistency_ad_set_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,88 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
ad_set_id, | ||
ad_set_name, | ||
account_id, | ||
campaign_id, | ||
start_at, | ||
end_at, | ||
bid_strategy, | ||
daily_budget, | ||
budget_remaining, | ||
status | ||
from {{ target.schema }}_facebook_ads_source_prod.stg_facebook_ads__ad_set_history | ||
where is_most_recent_record | ||
), | ||
|
||
dev as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
ad_set_id, | ||
ad_set_name, | ||
account_id, | ||
campaign_id, | ||
start_at, | ||
end_at, | ||
bid_strategy, | ||
daily_budget, | ||
budget_remaining, | ||
status | ||
from {{ target.schema }}_facebook_ads_source_dev.stg_facebook_ads__ad_set_history | ||
where is_most_recent_record | ||
), | ||
|
||
final as ( | ||
select | ||
dev.source_relation as dev_source_relation, | ||
prod.source_relation as prod_source_relation, | ||
dev.updated_at as dev_updated_at, | ||
prod.updated_at as prod_updated_at, | ||
dev.ad_set_id as dev_ad_set_id, | ||
prod.ad_set_id as prod_ad_set_id, | ||
dev.ad_set_name as dev_ad_set_name, | ||
prod.ad_set_name as prod_ad_set_name, | ||
dev.account_id as dev_account_id, | ||
prod.account_id as prod_account_id, | ||
dev.campaign_id as dev_campaign_id, | ||
prod.campaign_id as prod_campaign_id, | ||
dev.start_at as dev_start_at, | ||
prod.start_at as prod_start_at, | ||
dev.end_at as dev_end_at, | ||
prod.end_at as prod_end_at, | ||
dev.bid_strategy as dev_bid_strategy, | ||
prod.bid_strategy as prod_bid_strategy, | ||
dev.daily_budget as dev_daily_budget, | ||
prod.daily_budget as prod_daily_budget, | ||
dev.budget_remaining as dev_budget_remaining, | ||
prod.budget_remaining as prod_budget_remaining, | ||
dev.status as dev_status, | ||
prod.status as prod_status | ||
|
||
from prod | ||
full outer join dev | ||
on dev.ad_set_id = prod.ad_set_id | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
prod_source_relation != dev_source_relation | ||
or prod_updated_at != dev_updated_at | ||
or prod_ad_set_id != dev_ad_set_id | ||
or prod_ad_set_name != dev_ad_set_name | ||
or prod_account_id != dev_account_id | ||
or prod_campaign_id != dev_campaign_id | ||
or prod_start_at != dev_start_at | ||
or prod_end_at != dev_end_at | ||
or prod_bid_strategy != dev_bid_strategy | ||
or prod_daily_budget != dev_daily_budget | ||
or prod_budget_remaining != dev_budget_remaining | ||
or prod_status != dev_status |
90 changes: 90 additions & 0 deletions
90
integration_tests/tests/consistency/consistency_campaign_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,90 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
created_at, | ||
account_id, | ||
campaign_id, | ||
campaign_name, | ||
start_at, | ||
end_at, | ||
status, | ||
daily_budget, | ||
lifetime_budget, | ||
budget_remaining | ||
|
||
from {{ target.schema }}_facebook_ads_source_prod.stg_facebook_ads__campaign_history | ||
where is_most_recent_record | ||
), | ||
|
||
dev as ( | ||
select | ||
source_relation, | ||
updated_at, | ||
created_at, | ||
account_id, | ||
campaign_id, | ||
campaign_name, | ||
start_at, | ||
end_at, | ||
status, | ||
daily_budget, | ||
lifetime_budget, | ||
budget_remaining | ||
|
||
from {{ target.schema }}_facebook_ads_source_dev.stg_facebook_ads__campaign_history | ||
where is_most_recent_record | ||
), | ||
|
||
final as ( | ||
select | ||
dev.source_relation as dev_source_relation, | ||
prod.source_relation as prod_source_relation, | ||
dev.updated_at as dev_updated_at, | ||
prod.updated_at as prod_updated_at, | ||
dev.created_at as dev_created_at, | ||
prod.created_at as prod_created_at, | ||
dev.account_id as dev_account_id, | ||
prod.account_id as prod_account_id, | ||
dev.campaign_id as dev_campaign_id, | ||
prod.campaign_id as prod_campaign_id, | ||
dev.campaign_name as dev_campaign_name, | ||
prod.campaign_name as prod_campaign_name, | ||
dev.start_at as dev_start_at, | ||
prod.start_at as prod_start_at, | ||
dev.end_at as dev_end_at, | ||
prod.end_at as prod_end_at, | ||
dev.status as dev_status, | ||
prod.status as prod_status, | ||
dev.daily_budget as dev_daily_budget, | ||
prod.daily_budget as prod_daily_budget, | ||
dev.lifetime_budget as dev_lifetime_budget, | ||
prod.lifetime_budget as prod_lifetime_budget, | ||
dev.budget_remaining as dev_budget_remaining, | ||
prod.budget_remaining as prod_budget_remaining | ||
|
||
from prod | ||
full outer join dev | ||
on dev.campaign_id = prod.campaign_id | ||
) | ||
|
||
select * | ||
from final | ||
where | ||
prod_source_relation != dev_source_relation | ||
or prod_updated_at != dev_updated_at | ||
or prod_created_at != dev_created_at | ||
or prod_account_id != dev_account_id | ||
or prod_campaign_id != dev_campaign_id | ||
or prod_campaign_name != dev_campaign_name | ||
or prod_start_at != dev_start_at | ||
or prod_end_at != dev_end_at | ||
or prod_status != dev_status | ||
or prod_daily_budget != dev_daily_budget | ||
or prod_lifetime_budget != dev_lifetime_budget | ||
or prod_budget_remaining != dev_budget_remaining |
Oops, something went wrong.