diff --git a/elementary/monitor/api/tests/tests.py b/elementary/monitor/api/tests/tests.py index e3f1165c8..4d603a4ea 100644 --- a/elementary/monitor/api/tests/tests.py +++ b/elementary/monitor/api/tests/tests.py @@ -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 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, @@ -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": diff --git a/elementary/monitor/dbt_project/package-lock.yml b/elementary/monitor/dbt_project/package-lock.yml index ba9e799d7..7cf1cd441 100644 --- a/elementary/monitor/dbt_project/package-lock.yml +++ b/elementary/monitor/dbt_project/package-lock.yml @@ -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 diff --git a/elementary/monitor/dbt_project/packages.yml b/elementary/monitor/dbt_project/packages.yml index ce01a162c..186a0a046 100644 --- a/elementary/monitor/dbt_project/packages.yml +++ b/elementary/monitor/dbt_project/packages.yml @@ -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