Skip to content

Commit

Permalink
Merge pull request #1562 from elementary-data/ele-3195-webapp-report-…
Browse files Browse the repository at this point in the history
…exclude-metrics-collection-dbt-tests-from

Excluding test results with 'meta.elementary.include=false'.
  • Loading branch information
elongl authored Jun 25, 2024
2 parents 47c18e3 + cc6fbdc commit 81ab16e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion elementary/monitor/dbt_project/macros/get_test_results.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@
order by elementary_unique_id, invocations_rank_index desc
{%- endset -%}

{% set test_results = [] %}
{% set test_results_agate = elementary.run_query(select_test_results) %}
{% set test_result_rows_agate = elementary_cli.get_result_rows_agate(days_back) %}
{% set tests = elementary.agate_to_dicts(test_results_agate) %}
{%- for test in tests -%}
{% set test_meta = fromjson(test.meta) %}
{% if not test_meta.get("elementary", {}).get("include", true) %}
{% continue %}
{% endif %}

{% set test_rows_sample = none %}
{% if test.invocations_rank_index == 1 %}
{% set test_type = test.test_type %}
Expand Down Expand Up @@ -114,6 +120,8 @@
{% endif %}
{# Adding sample data to test results #}
{% do test.update({"sample_data": test_rows_sample}) %}
{% do test_results.append(test) %}
{%- endfor -%}
{% do return(tests) %}

{% do return(test_results) %}
{%- endmacro -%}

0 comments on commit 81ab16e

Please sign in to comment.