Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 7 additions & 5 deletions elementary/monitor/api/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,11 @@ def _get_test_result_from_test_result_db_row(
) -> Optional[Union[DbtTestResultSchema, ElementaryTestResultSchema]]:
test_results: Optional[Union[DbtTestResultSchema, ElementaryTestResultSchema]]

sample_data = test_result_db_row.sample_data if not disable_samples else None
Copy link
Collaborator Author

@haritamar haritamar Oct 28, 2025

Choose a reason for hiding this comment

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

There was a bug here where the disable_samples flags also removed anomaly tests rows (metrics), which is incorrect

if test_result_db_row.test_type == "dbt_test":
# Sample data is always a list for non-elementary tests
sample_data = cast(Optional[list], sample_data)
sample_data = cast(Optional[list], test_result_db_row.sample_data)
if disable_samples:
sample_data = None

test_results = DbtTestResultSchema(
display_name=test_result_db_row.test_name,
Expand All @@ -460,14 +461,15 @@ def _get_test_result_from_test_result_db_row(
"_", " "
).title()
if test_result_db_row.test_type == "anomaly_detection":
metrics = test_result_db_row.sample_data
if (
isinstance(sample_data, list)
isinstance(metrics, list)
and test_result_db_row.test_sub_type != "dimension"
):
sample_data.sort(key=lambda metric: metric.get("end_time"))
metrics.sort(key=lambda metric: metric.get("end_time"))
test_results = ElementaryTestResultSchema(
display_name=test_sub_type_display_name,
metrics=sample_data,
metrics=metrics,
result_description=test_result_db_row.test_results_description,
)
elif test_result_db_row.test_type == "schema_change":
Expand Down
4 changes: 2 additions & 2 deletions elementary/monitor/dbt_project/package-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ packages:
- package: dbt-labs/dbt_utils
version: 0.8.6
- git: https://github.com/elementary-data/dbt-data-reliability.git
revision: 20b76374f7c1b6cc280af7652c720e6069499a19
sha1_hash: 78546c8dc4ab641d9a66ebe04f4cd5818e4c0c37
revision: a01c958a3ee272b253d8e971e128c78a72b79239
sha1_hash: c91170dd00244625c43a676e888c3a824eaeb28a
14 changes: 7 additions & 7 deletions elementary/monitor/dbt_project/packages.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
packages:
- package: dbt-labs/dbt_utils
version: [">=0.8.0", "<0.9.0"]
# - package: elementary-data/elementary
# version: 0.20.0
- git: https://github.com/elementary-data/dbt-data-reliability.git
revision: a01c958a3ee272b253d8e971e128c78a72b79239

# NOTE - for unreleased CLI versions we often need to update the package version to a commit hash (please leave this
# commented, so it will be easy to access)
- git: https://github.com/elementary-data/dbt-data-reliability.git
revision: 20b76374f7c1b6cc280af7652c720e6069499a19
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
#- package: elementary-data/elementary
# version: 0.20.0
# - git: https://github.com/elementary-data/dbt-data-reliability.git
# revision: 20b76374f7c1b6cc280af7652c720e6069499a19
# When releasing a new version of the package, if the current version is using a commit hash, update the version to the new version.
# - package: elementary-data/elementary
# version: 0.20.0
Loading