Skip to content

Commit ff1fc83

Browse files
authored
Ele 5146 bugfix to disable_samples flag + update package ref (#2039)
* report: disable_samples should only affect dbt tests * update package dependency in CLI dbt project * update package lock * return old comment * remove name from package lock * update dbt package version * update package-lock * disable_samples - preserve previous behavior for dbt tests by setting to None
1 parent c9211de commit ff1fc83

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

elementary/monitor/api/tests/tests.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,11 @@ def _get_test_result_from_test_result_db_row(
444444
) -> Optional[Union[DbtTestResultSchema, ElementaryTestResultSchema]]:
445445
test_results: Optional[Union[DbtTestResultSchema, ElementaryTestResultSchema]]
446446

447-
sample_data = test_result_db_row.sample_data if not disable_samples else None
448447
if test_result_db_row.test_type == "dbt_test":
449448
# Sample data is always a list for non-elementary tests
450-
sample_data = cast(Optional[list], sample_data)
449+
sample_data = cast(Optional[list], test_result_db_row.sample_data)
450+
if disable_samples:
451+
sample_data = None
451452

452453
test_results = DbtTestResultSchema(
453454
display_name=test_result_db_row.test_name,
@@ -460,14 +461,15 @@ def _get_test_result_from_test_result_db_row(
460461
"_", " "
461462
).title()
462463
if test_result_db_row.test_type == "anomaly_detection":
464+
metrics = test_result_db_row.sample_data
463465
if (
464-
isinstance(sample_data, list)
466+
isinstance(metrics, list)
465467
and test_result_db_row.test_sub_type != "dimension"
466468
):
467-
sample_data.sort(key=lambda metric: metric.get("end_time"))
469+
metrics.sort(key=lambda metric: metric.get("end_time"))
468470
test_results = ElementaryTestResultSchema(
469471
display_name=test_sub_type_display_name,
470-
metrics=sample_data,
472+
metrics=metrics,
471473
result_description=test_result_db_row.test_results_description,
472474
)
473475
elif test_result_db_row.test_type == "schema_change":

elementary/monitor/dbt_project/package-lock.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ packages:
22
- package: dbt-labs/dbt_utils
33
version: 0.8.6
44
- git: https://github.com/elementary-data/dbt-data-reliability.git
5-
revision: 20b76374f7c1b6cc280af7652c720e6069499a19
6-
sha1_hash: 78546c8dc4ab641d9a66ebe04f4cd5818e4c0c37
5+
revision: a01c958a3ee272b253d8e971e128c78a72b79239
6+
sha1_hash: c91170dd00244625c43a676e888c3a824eaeb28a
Lines changed: 7 additions & 7 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-
# - package: elementary-data/elementary
5-
# version: 0.20.0
4+
- git: https://github.com/elementary-data/dbt-data-reliability.git
5+
revision: a01c958a3ee272b253d8e971e128c78a72b79239
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)
9-
- git: https://github.com/elementary-data/dbt-data-reliability.git
10-
revision: 20b76374f7c1b6cc280af7652c720e6069499a19
11-
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
12-
#- package: elementary-data/elementary
13-
# version: 0.20.0
9+
# - git: https://github.com/elementary-data/dbt-data-reliability.git
10+
# revision: 20b76374f7c1b6cc280af7652c720e6069499a19
11+
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
12+
# - package: elementary-data/elementary
13+
# version: 0.20.0

0 commit comments

Comments
 (0)