Initial publish of dbt_f2dq (f2dq) package v0.12.1.
Clean package repo for Gitea installs via packages.yml git URL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
{% macro export_alerts(start_date, end_date, alerts_path=None, monitored_path=None) %}
|
||||
{% set alerts_query %}
|
||||
select
|
||||
type as {{ f2dq.quote_column('type') }},
|
||||
model as {{ f2dq.quote_column('model') }},
|
||||
message as {{ f2dq.quote_column('message') }},
|
||||
value as {{ f2dq.quote_column('value') }},
|
||||
{{ format_timestamp('time_window_end')}} as {{ f2dq.quote_column('time_window_end') }}
|
||||
from {{ ref('f2dq_alerts') }}
|
||||
where
|
||||
case
|
||||
when type = 'anomaly' then {{ in_date_window('time_window_end', start_date, end_date) }}
|
||||
else {{ in_date_window('time_window_end', start_date, none) }}
|
||||
end
|
||||
order by time_window_end desc
|
||||
{% endset %}
|
||||
|
||||
{% set query_result = run_query(alerts_query) %}
|
||||
{% set alerts_file_path = alerts_path or 'target/f2dq/alerts.json' %}
|
||||
{% do query_result.to_json(alerts_file_path) %}
|
||||
{{ save_monitored(monitored_path) }}
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user