From f5a6480503f41b85e6eba3d13df3e1b19b8fc663 Mon Sep 17 00:00:00 2001 From: Tyler Hoffman Date: Mon, 19 Aug 2024 11:35:45 -0400 Subject: [PATCH 1/2] Update import path for UnexpectedRowsExpectation --- great_expectations/expectations/__init__.py | 2 +- tests/expectations/test_expectation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/great_expectations/expectations/__init__.py b/great_expectations/expectations/__init__.py index 8c49a74b5099..31290ccd9080 100644 --- a/great_expectations/expectations/__init__.py +++ b/great_expectations/expectations/__init__.py @@ -1,4 +1,4 @@ -from great_expectations.expectations.expectation import Expectation +from great_expectations.expectations.expectation import Expectation, UnexpectedRowsExpectation from .core import ( ExpectColumnDistinctValuesToBeInSet, diff --git a/tests/expectations/test_expectation.py b/tests/expectations/test_expectation.py index d379f59455b0..03c27b6a0218 100644 --- a/tests/expectations/test_expectation.py +++ b/tests/expectations/test_expectation.py @@ -9,11 +9,11 @@ from great_expectations.compatibility import pydantic from great_expectations.data_context.util import file_relative_path from great_expectations.exceptions import InvalidExpectationConfigurationError +from great_expectations.expectations import UnexpectedRowsExpectation from great_expectations.expectations.expectation import ( ColumnMapExpectation, ColumnPairMapExpectation, MulticolumnMapExpectation, - UnexpectedRowsExpectation, _validate_dependencies_against_available_metrics, ) from great_expectations.expectations.expectation_configuration import ( From 0861218c8b9b2956180d87e10e6686b1265dff4c Mon Sep 17 00:00:00 2001 From: Tyler Hoffman Date: Mon, 19 Aug 2024 11:51:53 -0400 Subject: [PATCH 2/2] Make UnexpectedRowsExpectation a concrete class --- docs/docusaurus/docs/snippets/unexpected_row_expectation.py | 2 +- great_expectations/expectations/expectation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docusaurus/docs/snippets/unexpected_row_expectation.py b/docs/docusaurus/docs/snippets/unexpected_row_expectation.py index 93b4ae5b2a13..11449c487dfb 100644 --- a/docs/docusaurus/docs/snippets/unexpected_row_expectation.py +++ b/docs/docusaurus/docs/snippets/unexpected_row_expectation.py @@ -28,7 +28,7 @@ # class UnexpectedTripDistance(UnexpectedRowsExpectation): - unexpected_rows_query = """ + unexpected_rows_query: str = """ SELECT vendor_id, pickup_datetime FROM diff --git a/great_expectations/expectations/expectation.py b/great_expectations/expectations/expectation.py index 8fe3c255390c..bc68bf4e430f 100644 --- a/great_expectations/expectations/expectation.py +++ b/great_expectations/expectations/expectation.py @@ -1613,7 +1613,7 @@ def _validate_metric_value_between( # noqa: C901, PLR0912 return {"success": success, "result": {"observed_value": metric_value}} -class UnexpectedRowsExpectation(BatchExpectation, ABC): +class UnexpectedRowsExpectation(BatchExpectation): """ UnexpectedRowsExpectations facilitate the execution of SQL or Spark-SQL queries as the core logic for an Expectation.