-
Notifications
You must be signed in to change notification settings - Fork 41
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 #29 from re-data/feature/new-dbt
Couple changes: - Update dbt version - Add more tests - Update to snowflake conf -> upper case snowflake schema - 2 additional helping macros
- Loading branch information
Showing
12 changed files
with
156 additions
and
21 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
91 changes: 91 additions & 0 deletions
91
integration_tests/data/expected/expected_sample_data_metrics.csv
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,91 @@ | ||
table_name,column_name,metric,value,time_window_start,time_window_end,interval_length_sec | ||
"""postgres"".""dq_raw"".""sample_table""",value1,min,100,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,max,200,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,avg,127.5,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,stddev,48.562674281111555,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,variance,2358.3333333333335,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,nulls_count,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,nulls_percent,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,diff,100,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,min,109,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,max,209,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,avg,180.75,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,stddev,47.97481978427155,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,variance,2301.5833333333335,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,nulls_count,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,nulls_percent,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,diff,100,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,min,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,max,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,avg,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,stddev,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,variance,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,nulls_count,4,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,nulls_percent,100,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,diff,,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,min_length,3,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,max_length,4,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,avg_length,3.25,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,nulls_count,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,nulls_percent,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,missing_percent,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,missing_count,0,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,regex_test,4,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,match_regex,1,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,match_regex_percent,25,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,not_match_regex,1,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,not_match_regex_percent,25,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,distinct_values,2,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,duplicate_values,1,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,duplicate_rows,3,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,unique_rows,1,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",row_count,4,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",freshness,40765,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",buy_count,3,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",my_custom_table_metric,1000,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",distinct_table_rows,4,2021-05-01 00:00:00,2021-05-02 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,min,100,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,max,210,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,avg,142.5,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,stddev,49.91659710623979,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,variance,2491.6666666666665,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,nulls_count,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,nulls_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value1,diff,110,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,min,109,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,max,209,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,avg,180.75,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,stddev,47.97481978427155,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,variance,2301.5833333333335,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,nulls_count,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,nulls_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",value2,diff,100,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,min,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,max,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,avg,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,stddev,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,variance,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,nulls_count,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,nulls_percent,100,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",null_value,diff,,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,min_length,3,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,max_length,3,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,avg_length,3,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,nulls_count,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,nulls_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,missing_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,missing_count,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,regex_test,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,match_regex,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,match_regex_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,not_match_regex,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,not_match_regex_percent,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,distinct_values,1,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,duplicate_values,1,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,duplicate_rows,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""",event_type,unique_rows,0,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",row_count,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",freshness,40765,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",buy_count,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",my_custom_table_metric,1000,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 | ||
"""postgres"".""dq_raw"".""sample_table""","",distinct_table_rows,4,2021-05-02 00:00:00,2021-05-03 00:00:00,86400 |
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,6 @@ | ||
{% set table_name = re_data.full_table_name_values( | ||
"sample_table", target.schema + "_raw", re_data.get_target_database()) %} | ||
|
||
select * from {{ ref('re_data_metrics')}} | ||
where table_name = {{ table_name }} | ||
|
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,13 @@ | ||
|
||
{% macro schema_name(name) %} | ||
{% set result = adapter.dispatch('schema_name', 're_data')(name) %} | ||
{{ return(result) }} | ||
{% endmacro %} | ||
|
||
{% macro default__schema_name(name) %} | ||
{{ return (name) }} | ||
{% endmacro %} | ||
|
||
{% macro snowflake__schema_name(name) %} | ||
{{ return (name.upper()) }} | ||
{% 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
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,8 +1,7 @@ | ||
{% macro re_data_metric_distinct_table_rows(context) %} | ||
( with temp_table AS ( | ||
with temp_table AS ( | ||
select distinct * from {{ context.table_name }} | ||
where {{ in_time_window(context.time_filter) }} | ||
) | ||
select coalesce(count(*), 0) FROM temp_table | ||
) | ||
select coalesce(count(*), 0) FROM temp_table | ||
{% 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
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,16 @@ | ||
|
||
{% macro get_target_database() %} | ||
{{- adapter.dispatch('get_target_database', 're_data')() -}} | ||
{% endmacro %} | ||
|
||
{% macro default__get_target_database() %} | ||
{{- return (target.dbname) -}} | ||
{% endmacro %} | ||
|
||
{% macro bigquery__get_target_database() %} | ||
{{- return (target.project) -}} | ||
{% endmacro %} | ||
|
||
{% macro snowflake__get_target_database() %} | ||
{{- return (target.database) -}} | ||
{% 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