-
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 #141 from fivetran/feature/add_transformation_runs
Feature/add transformation runs
- Loading branch information
Showing
20 changed files
with
318 additions
and
57 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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
destination_id,job_id,measured_date,project_type,free_type,job_name,updated_at,model_runs,_fivetran_synced | ||
egg_shell,formosa,2024-12-15 00:00:00.000000,QUICKSTART,PAID,Github/staging,2024-12-15 18:13:59.840000,6,2024-12-16 00:11:52.792000 | ||
egg_shell,macau,2024-12-08 00:00:00.000000,QUICKSTART,PROMOTION,Github/staging,2024-12-09 15:21:02.278000,6,2024-12-09 18:11:46.905000 |
44 changes: 44 additions & 0 deletions
44
integration_tests/tests/integrity/run_count__usage_mar_destination_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,44 @@ | ||
|
||
{{ config( | ||
tags="fivetran_validations", | ||
enabled=var('fivetran_validation_tests_enabled', false) | ||
) }} | ||
|
||
with end_model as ( | ||
select | ||
measured_month, | ||
destination_id, | ||
sum(total_model_runs) as total_model_runs, | ||
sum(paid_model_runs) as paid_model_runs, | ||
sum(free_model_runs) as free_model_runs | ||
from {{ ref('fivetran_platform__usage_mar_destination_history') }} | ||
group by 1,2 | ||
), | ||
|
||
staging_model as ( | ||
select | ||
measured_month, | ||
destination_id, | ||
sum(model_runs) as total_model_runs, | ||
sum(case when free_type = 'PAID' then model_runs else 0 end) as paid_model_runs, | ||
sum(case when free_type != 'PAID' then model_runs else 0 end) as free_model_runs | ||
from {{ ref('stg_fivetran_platform__transformation_runs') }} | ||
group by 1,2 | ||
) | ||
|
||
select | ||
end_model.measured_month, | ||
end_model.destination_id, | ||
end_model.total_model_runs, | ||
end_model.paid_model_runs, | ||
end_model.free_model_runs, | ||
staging_model.total_model_runs, | ||
staging_model.paid_model_runs, | ||
staging_model.free_model_runs | ||
from end_model | ||
left join staging_model | ||
on end_model.destination_id = staging_model.destination_id | ||
and end_model.measured_month = staging_model.measured_month | ||
where staging_model.total_model_runs != end_model.total_model_runs | ||
or staging_model.paid_model_runs != end_model.paid_model_runs | ||
or staging_model.free_model_runs != end_model.free_model_runs |
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,17 @@ | ||
{% macro get_transformation_runs_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, | ||
{"name": "destination_id", "datatype": dbt.type_string()}, | ||
{"name": "free_type", "datatype": dbt.type_string()}, | ||
{"name": "job_id", "datatype": dbt.type_string()}, | ||
{"name": "job_name", "datatype": dbt.type_string()}, | ||
{"name": "measured_date", "datatype": dbt.type_timestamp()}, | ||
{"name": "model_runs", "datatype": dbt.type_int()}, | ||
{"name": "project_type", "datatype": dbt.type_string()}, | ||
{"name": "updated_at", "datatype": dbt.type_timestamp()} | ||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
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
Oops, something went wrong.