Skip to content

Commit

Permalink
add to freshness result criteria (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoyaArie authored Sep 27, 2023
1 parent 70fc7e3 commit 83f0f46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions macros/edr/dbt_artifacts/upload_source_freshness.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
{% endif %}
{% endfor %}
{% set metadata_dict = elementary.safe_get_with_default(node_dict, 'metadata', {}) %}
{% set criteria_dict = elementary.safe_get_with_default(node_dict, 'criteria', {}) %}
{% set source_freshness_invocation_id = metadata_dict.get('invocation_id', invocation_id) %}
{% set flatten_source_freshness_dict = {
'source_freshness_execution_id': [source_freshness_invocation_id, node_dict.get('unique_id')] | join('.'),
Expand All @@ -32,6 +33,9 @@
'max_loaded_at_time_ago_in_s': node_dict.get('max_loaded_at_time_ago_in_s'),
'status': node_dict.get('status'),
'error': node_dict.get('error'),
'warn_after': criteria_dict.get('warn_after'),
'error_after': criteria_dict.get('error_after'),
'filter': criteria_dict.get('filter'),
'generated_at': elementary.datetime_now_utc_as_string(),
'invocation_id': source_freshness_invocation_id,
'compile_started_at': compile_timing.get('started_at'),
Expand Down
5 changes: 4 additions & 1 deletion macros/edr/system/system_utils/empty_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
('compile_completed_at', 'string'),
('execute_started_at', 'string'),
('execute_completed_at', 'string'),
('invocation_id', 'string')
('invocation_id', 'string'),
('warn_after', 'string'),
('error_after', 'string'),
('filter', 'long_string')
]) }}
{% endmacro %}

Expand Down
6 changes: 3 additions & 3 deletions models/edr/alerts/alerts_dbt_source_freshness.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ select
results.max_loaded_at_time_ago_in_s,
results.status,
results.error,
results.warn_after,
results.error_after,
results.filter,
sources.unique_id,
sources.database_name,
sources.schema_name,
sources.source_name,
sources.identifier,
sources.freshness_error_after,
sources.freshness_warn_after,
sources.freshness_filter,
sources.tags,
sources.meta,
sources.owner,
Expand Down

0 comments on commit 83f0f46

Please sign in to comment.