Skip to content

Commit 701198f

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix/replace-double-quotes-with-single-quotes
2 parents a3a3581 + 133b631 commit 701198f

File tree

7 files changed

+1035
-797
lines changed

7 files changed

+1035
-797
lines changed

.github/workflows/test-warehouse.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
run: |
137137
mkdir -p ~/.dbt
138138
DBT_VERSION=$(pip show dbt-core | grep -i version | awk '{print $2}' | sed 's/\.//g')
139-
UNDERSCORED_REF_NAME=$(echo "dbt_${DBT_VERSION}_${BRANCH_NAME}" | head -c 32 | sed "s/-/_/g")
139+
UNDERSCORED_REF_NAME=$(echo "${{ inputs.warehouse-type }}_dbt_${DBT_VERSION}_${BRANCH_NAME}" | awk '{print tolower($0)}' | head -c 40 | sed "s/[-\/]/_/g")
140140
echo "$PROFILES_YML" | base64 -d | sed "s/<SCHEMA_NAME>/py_$UNDERSCORED_REF_NAME/g" > ~/.dbt/profiles.yml
141141
142142
- name: Run Python package unit tests
@@ -168,7 +168,7 @@ jobs:
168168
env:
169169
SLACK_WEBHOOK: ${{ secrets.CI_SLACK_WEBHOOK }}
170170
run: >
171-
edr monitor
171+
edr monitor
172172
-t "${{ inputs.warehouse-type }}"
173173
--group-by table
174174
--project-dir "${{ env.DBT_PKG_INTEG_TESTS_DIR }}"
@@ -206,7 +206,7 @@ jobs:
206206
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
207207
AZURE_CONNECTION_STRING: ${{ secrets.AZURE_CONNECTION_STRING }}
208208
run: >
209-
edr monitor send-report
209+
edr monitor send-report
210210
-t "${{ inputs.warehouse-type }}"
211211
--project-dir "${{ env.DBT_PKG_INTEG_TESTS_DIR }}"
212212
--project-profile-target "${{ inputs.warehouse-type }}"

docs/_snippets/quickstart-package-install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Some packages we recommend you check out: [dbt_utils](https://github.com/dbt-lab
3939
```yml packages.yml
4040
packages:
4141
- package: elementary-data/elementary
42-
version: 0.19.2
42+
version: 0.19.4
4343
## Docs: https://docs.elementary-data.com
4444
```
4545
</Step>

elementary/monitor/data_monitoring/report/index.html

Lines changed: 1020 additions & 698 deletions
Large diffs are not rendered by default.

elementary/monitor/dbt_project/macros/get_test_results.sql

Lines changed: 4 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
{%- macro default__get_test_results(days_back = 7, invocations_per_test = 720, disable_passed_test_metrics = false) -%}
66
{% set elementary_tests_allowlist_status = ['fail', 'warn'] if disable_passed_test_metrics else ['fail', 'warn', 'pass'] %}
7-
87
{% set select_test_results %}
98
with test_results as (
109
{{ elementary_cli.current_tests_run_results_query(days_back=days_back) }}
@@ -19,7 +18,7 @@
1918
from test_results
2019
)
2120

22-
select
21+
select
2322
test_results.id,
2423
test_results.invocation_id,
2524
test_results.test_execution_id,
@@ -70,7 +69,7 @@
7069
{% endset %}
7170

7271
{% set valid_ids_query %}
73-
select distinct id
72+
select distinct id
7473
from {{ ordered_test_results_relation }}
7574
where invocations_rank_index = 1
7675
{% endset %}
@@ -99,54 +98,12 @@
9998

10099
{%- if (test_type == 'dbt_test' and status in ['fail', 'warn']) or (test_type != 'dbt_test' and status in elementary_tests_allowlist_status) -%}
101100
{% set test_rows_sample = elementary_cli.get_test_rows_sample(test.result_rows, test_result_rows_agate.get(test.id)) %}
102-
{# Dimension anomalies return multiple dimensions for the test rows sample, and needs to be handle differently. #}
103-
{# Currently we show only the anomalous for all of the dimensions. #}
104-
{% if test.test_sub_type == 'dimension' or test_params.dimensions %}
105-
{% if test.test_sub_type == 'dimension' %}
106-
{% set metric_name = 'row_count' %}
107-
{% elif test_params.dimensions %}
108-
{% set metric_name = test.test_sub_type %}
109-
{% endif %}
110-
{% set anomalous_rows = [] %}
111-
{% set headers = [{'id': 'anomalous_value_timestamp', 'display_name': 'timestamp', 'type': 'date'}] %}
112-
{% for row in test_rows_sample %}
113-
{% set anomalous_row = {
114-
'anomalous_value_timestamp': row['end_time'],
115-
'anomalous_value_' ~ metric_name: row['value'],
116-
'anomalous_value_average_' ~ metric_name: row['average'] | round(1)
117-
} %}
118-
{% set dimensions = row['dimension'].split('; ') %}
119-
{% set diemsions_values = row['dimension_value'].split('; ') %}
120-
{% for index in range(dimensions | length) %}
121-
{% do anomalous_row.update({dimensions[index]: diemsions_values[index]}) %}
122-
{% endfor %}
123-
{% if loop.last %}
124-
{# Adding dimensions to the headers #}
125-
{% for index in range(dimensions | length) %}
126-
{% do headers.append({'id': dimensions[index], 'display_name': dimensions[index], 'type': 'str'},) %}
127-
{% endfor %}
128-
{% endif %}
129-
{% if row['is_anomalous'] %}
130-
{% do anomalous_rows.append(anomalous_row) %}
131-
{% endif %}
132-
{% endfor %}
133-
{# Adding the rest of the static headers (metrics headers) #}
134-
{% do headers.extend([
135-
{'id': 'anomalous_value_' ~ metric_name, 'display_name': ' '.join(metric_name.split('_')), 'type': 'int'},
136-
{'id': 'anomalous_value_average_' ~ metric_name, 'display_name': 'average ' ~ ' '.join(metric_name.split('_')), 'type': 'int'}
137-
]) %}
138-
{% set test_rows_sample = {
139-
'headers': headers,
140-
'test_rows_sample': anomalous_rows
141-
} %}
142-
{% endif %}
143101
{%- endif -%}
144102
{% endif %}
145103
{# Adding sample data to test results #}
146104
{% do test.update({"sample_data": test_rows_sample}) %}
147105
{% do test_results.append(test) %}
148106
{%- endfor -%}
149-
150107
{% do return(test_results) %}
151108
{%- endmacro -%}
152109

@@ -242,7 +199,7 @@
242199
FROM {{ ref('elementary', 'elementary_test_results') }} etr
243200
JOIN {{ ref('elementary', 'dbt_tests') }} dt ON etr.test_unique_id = dt.unique_id
244201
LEFT JOIN (
245-
SELECT
202+
SELECT
246203
min(detected_at) AS first_time_occurred,
247204
test_unique_id
248205
FROM {{ ref('elementary', 'elementary_test_results') }}
@@ -272,7 +229,7 @@
272229
{% endset %}
273230

274231
{% set valid_ids_query %}
275-
select distinct id
232+
select distinct id
276233
from {{ ordered_test_results_relation }}
277234
where invocations_rank_index = 1
278235
{% endset %}
@@ -301,47 +258,6 @@
301258

302259
{%- if (test_type == 'dbt_test' and status in ['fail', 'warn']) or (test_type != 'dbt_test' and status in elementary_tests_allowlist_status) -%}
303260
{% set test_rows_sample = elementary_cli.get_test_rows_sample(test.result_rows, test_result_rows_agate.get(test.id)) %}
304-
{# Dimension anomalies return multiple dimensions for the test rows sample, and needs to be handle differently. #}
305-
{# Currently we show only the anomalous for all of the dimensions. #}
306-
{% if test.test_sub_type == 'dimension' or test_params.dimensions %}
307-
{% if test.test_sub_type == 'dimension' %}
308-
{% set metric_name = 'row_count' %}
309-
{% elif test_params.dimensions %}
310-
{% set metric_name = test.test_sub_type %}
311-
{% endif %}
312-
{% set anomalous_rows = [] %}
313-
{% set headers = [{'id': 'anomalous_value_timestamp', 'display_name': 'timestamp', 'type': 'date'}] %}
314-
{% for row in test_rows_sample %}
315-
{% set anomalous_row = {
316-
'anomalous_value_timestamp': row['end_time'],
317-
'anomalous_value_' ~ metric_name: row['value'],
318-
'anomalous_value_average_' ~ metric_name: row['average'] | round(1)
319-
} %}
320-
{% set dimensions = row['dimension'].split('; ') %}
321-
{% set diemsions_values = row['dimension_value'].split('; ') %}
322-
{% for index in range(dimensions | length) %}
323-
{% do anomalous_row.update({dimensions[index]: diemsions_values[index]}) %}
324-
{% endfor %}
325-
{% if loop.last %}
326-
{# Adding dimensions to the headers #}
327-
{% for index in range(dimensions | length) %}
328-
{% do headers.append({'id': dimensions[index], 'display_name': dimensions[index], 'type': 'str'},) %}
329-
{% endfor %}
330-
{% endif %}
331-
{% if row['is_anomalous'] %}
332-
{% do anomalous_rows.append(anomalous_row) %}
333-
{% endif %}
334-
{% endfor %}
335-
{# Adding the rest of the static headers (metrics headers) #}
336-
{% do headers.extend([
337-
{'id': 'anomalous_value_' ~ metric_name, 'display_name': ' '.join(metric_name.split('_')), 'type': 'int'},
338-
{'id': 'anomalous_value_average_' ~ metric_name, 'display_name': 'average ' ~ ' '.join(metric_name.split('_')), 'type': 'int'}
339-
]) %}
340-
{% set test_rows_sample = {
341-
'headers': headers,
342-
'test_rows_sample': anomalous_rows
343-
} %}
344-
{% endif %}
345261
{%- endif -%}
346262
{% endif %}
347263
{# Adding sample data to test results #}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
packages:
22
- package: dbt-labs/dbt_utils
33
version: 0.8.6
4-
- git: https://github.com/elementary-data/dbt-data-reliability.git
5-
revision: 257974756e195140204ac4a76278a26acf78a27f
6-
sha1_hash: 0bac331a6cf2d739e67a64cf27532d9502175e37
4+
- package: elementary-data/elementary
5+
version: 0.19.4
6+
sha1_hash: 5354a38209c635db10cbc4e465e7cd679167c74b
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
packages:
22
- package: dbt-labs/dbt_utils
33
version: [">=0.8.0", "<0.9.0"]
4-
- git: https://github.com/elementary-data/dbt-data-reliability.git
5-
revision: 257974756e195140204ac4a76278a26acf78a27f
4+
- package: elementary-data/elementary
5+
version: 0.19.4
66

77
# NOTE - for unreleased CLI versions we often need to update the package version to a commit hash (please leave this
88
# commented, so it will be easy to access)
99
#- git: https://github.com/elementary-data/dbt-data-reliability.git
1010
# revision: f22a2387d19dddd73c8a506d1a9cbb08204f83f9
1111
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
1212
#- package: elementary-data/elementary
13-
# version: 0.19.2
13+
# version: 0.19.4

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "elementary-data"
3-
version = "0.19.4"
3+
version = "0.19.5"
44
description = "Data monitoring and lineage"
55
authors = ["Elementary"]
66
keywords = ["data", "lineage", "data lineage", "data warehouse", "DWH", "observability", "data monitoring", "data observability", "Snowflake", "BigQuery", "Redshift", "data reliability", "analytics engineering"]

0 commit comments

Comments
 (0)