Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions elementary/monitor/dbt_project/macros/get_result_rows_agate.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{% macro get_result_rows_agate(days_back, valid_ids_query = none) %}
{% do return(adapter.dispatch('get_result_rows_agate', 'elementary')(days_back, valid_ids_query)) %}
{% endmacro %}

{% macro default__get_result_rows_agate(days_back, valid_ids_query = none) %}
{% set query %}
select
elementary_test_results_id,
Expand All @@ -15,3 +19,17 @@
{% endif %}
{% do return(res.group_by("elementary_test_results_id")) %}
{% endmacro %}

{% macro bigquery__get_result_rows_agate(days_back, valid_ids_query = none) %}
{% set query %}
select
elementary_test_results_id,
result_row
from {{ ref("elementary", "test_result_rows") }}
where detected_at >= {{ elementary.edr_timeadd('day', -1 * days_back, elementary.edr_current_timestamp()) }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where detected_at >= {{ elementary.edr_timeadd('day', -1 * days_back, elementary.edr_current_timestamp()) }}
where detected_at > {{ elementary.edr_timeadd('day', -1 * days_back, elementary.edr_current_timestamp()) }}

for consistency with the default macro

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

{% if valid_ids_query %}
and elementary_test_results_id in ({{ valid_ids_query }})
{% endif %}
{% endset %}
{% do return(elementary.run_query(query).group_by("elementary_test_results_id")) %}
{% endmacro %}
Comment thread
tlangton3 marked this conversation as resolved.
Loading