-
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.
Merge pull request #58 from fivetran/release/v0.8.1
[Release] Version 0.8.1: Current_timestamp macro updates, pull request join fix
- Loading branch information
Showing
16 changed files
with
205 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ logs/ | |
keyfile.json | ||
.DS_Store | ||
develop/ | ||
dbt_packages/ | ||
dbt_packages/ | ||
env/ | ||
package-lock.yml |
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 was deleted.
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,2 +1,2 @@ | ||
packages: | ||
- local: ../ | ||
- local: ../ |
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 github__issues end model matches the prior version | ||
with prod as ( | ||
select * except(days_issue_open, labels, repository_team_names, assignees) --the differences in prod/dev run times will lead to discrepancies because it leverages current_timestamp, and string aggs don't always have the same order | ||
from {{ target.schema }}_github_prod.github__issues | ||
where date(updated_at) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
dev as ( | ||
select * except(days_issue_open, labels, repository_team_names, assignees) --the differences in prod/dev run times will lead to slight discrepancies because it leverages current_timestamp, and string aggs don't always order the same | ||
from {{ target.schema }}_github_dev.github__issues | ||
where date(updated_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 |
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,33 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_prod_pr_count | ||
from {{ target.schema }}_github_prod.github__issues | ||
group by 1 | ||
), | ||
|
||
dev as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_dev_pr_count | ||
from {{ target.schema }}_github_dev.github__issues | ||
group by 1 | ||
), | ||
|
||
final as ( | ||
select | ||
total_prod_pr_count, | ||
total_dev_pr_count | ||
from prod | ||
full outer join dev | ||
on dev.join_key = prod.join_key | ||
) | ||
|
||
select * | ||
from final | ||
where total_dev_pr_count != total_prod_pr_count |
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 github__pull_requests end model matches the prior version | ||
with prod as ( | ||
select * except(days_issue_open, hours_request_review_to_first_review, hours_request_review_to_first_action, hours_request_review_to_merge) --the differences in prod/dev run times will lead to discrepancies because these fields leverages current_timestamp | ||
from {{ target.schema }}_github_prod.github__pull_requests | ||
where date(updated_at) < date({{ dbt.current_timestamp() }}) | ||
), | ||
|
||
dev as ( | ||
select * except(days_issue_open, hours_request_review_to_first_review, hours_request_review_to_first_action, hours_request_review_to_merge) --the differences in prod/dev run times will lead to discrepancies because these fields leverages current_timestamp | ||
from {{ target.schema }}_github_prod.github__pull_requests | ||
where date(updated_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 |
33 changes: 33 additions & 0 deletions
33
integration_tests/tests/consistency_pull_requests_counts.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,33 @@ | ||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with prod as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_prod_pr_count | ||
from {{ target.schema }}_github_prod.github__pull_requests | ||
group by 1 | ||
), | ||
|
||
dev as ( | ||
select | ||
1 as join_key, | ||
count(*) as total_dev_pr_count | ||
from {{ target.schema }}_github_dev.github__pull_requests | ||
group by 1 | ||
), | ||
|
||
final as ( | ||
select | ||
total_prod_pr_count, | ||
total_dev_pr_count | ||
from prod | ||
full outer join dev | ||
on dev.join_key = prod.join_key | ||
) | ||
|
||
select * | ||
from final | ||
where total_dev_pr_count != total_prod_pr_count |
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