Skip to content

Commit

Permalink
[MAINTENANCE] Delete ExpectationSuite attribute data_asset_type (#9591)
Browse files Browse the repository at this point in the history
  • Loading branch information
billdirks committed Mar 7, 2024
1 parent 05f14db commit 5184ea7
Show file tree
Hide file tree
Showing 20 changed files with 7 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ This results in the following Expectation Suite:
},
"expectation_type": "expect_column_values_to_be_in_set"
}
],
"data_asset_type": "Dataset"
]
}
```

Expand Down
8 changes: 0 additions & 8 deletions great_expectations/core/expectation_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import great_expectations.exceptions as gx_exceptions
from great_expectations import __version__ as ge_version
from great_expectations._docs_decorators import (
deprecated_argument,
public_api,
)
from great_expectations.analytics.anonymizer import anonymize
Expand Down Expand Up @@ -68,15 +67,13 @@


@public_api
@deprecated_argument(argument_name="data_asset_type", version="0.14.0")
class ExpectationSuite(SerializableDictDot):
"""Set-like collection of Expectations.
Args:
name: Name of the Expectation Suite
expectations: Expectation Configurations to associate with this Expectation Suite.
evaluation_parameters: Evaluation parameters to be substituted when evaluating Expectations.
data_asset_type: Type of data asset to associate with this suite.
execution_engine_type: Name of the execution engine type.
meta: Metadata related to the suite.
id: Great Expectations Cloud id for this Expectation Suite.
Expand All @@ -89,7 +86,6 @@ def __init__( # noqa: PLR0913
Sequence[Union[dict, ExpectationConfiguration, Expectation]]
] = None,
evaluation_parameters: Optional[dict] = None,
data_asset_type: Optional[str] = None,
execution_engine_type: Optional[Type[ExecutionEngine]] = None,
meta: Optional[dict] = None,
notes: str | list[str] | None = None,
Expand All @@ -107,7 +103,6 @@ def __init__( # noqa: PLR0913
if evaluation_parameters is None:
evaluation_parameters = {}
self.evaluation_parameters = evaluation_parameters
self.data_asset_type = data_asset_type
self.execution_engine_type = execution_engine_type
if meta is None:
meta = {"great_expectations_version": ge_version}
Expand Down Expand Up @@ -348,7 +343,6 @@ def isEquivalentTo(self, other):
- data_asset_name
- name
- meta
- data_asset_type
"""
if not isinstance(other, self.__class__):
if isinstance(other, dict):
Expand Down Expand Up @@ -387,7 +381,6 @@ def __eq__(self, other):
self.name == other.name,
self.expectations == other.expectations,
self.evaluation_parameters == other.evaluation_parameters,
self.data_asset_type == other.data_asset_type,
self.meta == other.meta,
)
)
Expand Down Expand Up @@ -1123,7 +1116,6 @@ class ExpectationSuiteSchema(Schema):
id = fields.UUID(required=False, allow_none=True)
expectations = fields.List(fields.Nested("ExpectationConfigurationSchema"))
evaluation_parameters = fields.Dict(allow_none=True)
data_asset_type = fields.Str(allow_none=True)
meta = fields.Dict()
notes = fields.Raw(required=False, allow_none=True)

Expand Down
1 change: 0 additions & 1 deletion great_expectations/data_asset/data_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ def _initialize_expectations(
name=expectation_suite_name,
)

self._expectation_suite.data_asset_type = self._data_asset_type
self.default_expectation_args = {
"include_config": True,
"catch_exceptions": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,6 @@ def add_expectation_suite(
id: str | None = ...,
expectations: list[dict | ExpectationConfiguration] | None = ...,
evaluation_parameters: dict | None = ...,
data_asset_type: str | None = ...,
execution_engine_type: Type[ExecutionEngine] | None = ...,
meta: dict | None = ...,
expectation_suite: None = ...,
Expand All @@ -2159,7 +2158,6 @@ def add_expectation_suite(
id: str | None = ...,
expectations: list[dict | ExpectationConfiguration] | None = ...,
evaluation_parameters: dict | None = ...,
data_asset_type: str | None = ...,
execution_engine_type: Type[ExecutionEngine] | None = ...,
meta: dict | None = ...,
expectation_suite: ExpectationSuite = ...,
Expand All @@ -2178,7 +2176,6 @@ def add_expectation_suite( # noqa: PLR0913
id: str | None = None,
expectations: list[dict | ExpectationConfiguration] | None = None,
evaluation_parameters: dict | None = None,
data_asset_type: str | None = None,
execution_engine_type: Type[ExecutionEngine] | None = None,
meta: dict | None = None,
expectation_suite: ExpectationSuite | None = None,
Expand Down Expand Up @@ -2212,7 +2209,6 @@ def add_expectation_suite( # noqa: PLR0913
id: Identifier to associate with this suite.
expectations: Expectation Configurations to associate with this suite.
evaluation_parameters: Evaluation parameters to be substituted when evaluating Expectations.
data_asset_type: Type of data asset to associate with this suite.
execution_engine_type: Name of the execution engine type.
meta: Metadata related to the suite.
Expand All @@ -2228,7 +2224,6 @@ def add_expectation_suite( # noqa: PLR0913
id=id,
expectations=expectations,
evaluation_parameters=evaluation_parameters,
data_asset_type=data_asset_type,
execution_engine_type=execution_engine_type,
meta=meta,
expectation_suite=expectation_suite,
Expand All @@ -2241,7 +2236,6 @@ def _add_expectation_suite( # noqa: PLR0913
id: str | None = None,
expectations: Sequence[dict | ExpectationConfiguration] | None = None,
evaluation_parameters: dict | None = None,
data_asset_type: str | None = None,
execution_engine_type: Type[ExecutionEngine] | None = None,
meta: dict | None = None,
overwrite_existing: bool = False,
Expand All @@ -2266,7 +2260,6 @@ def _add_expectation_suite( # noqa: PLR0913
id=id,
expectations=expectations,
evaluation_parameters=evaluation_parameters,
data_asset_type=data_asset_type,
execution_engine_type=execution_engine_type,
meta=meta,
)
Expand Down Expand Up @@ -2335,7 +2328,6 @@ def add_or_update_expectation_suite(
id: str | None = ...,
expectations: list[dict | ExpectationConfiguration] | None = ...,
evaluation_parameters: dict | None = ...,
data_asset_type: str | None = ...,
execution_engine_type: Type[ExecutionEngine] | None = ...,
meta: dict | None = ...,
expectation_suite: None = ...,
Expand All @@ -2354,7 +2346,6 @@ def add_or_update_expectation_suite(
id: str | None = ...,
expectations: list[dict | ExpectationConfiguration] | None = ...,
evaluation_parameters: dict | None = ...,
data_asset_type: str | None = ...,
execution_engine_type: Type[ExecutionEngine] | None = ...,
meta: dict | None = ...,
expectation_suite: ExpectationSuite = ...,
Expand All @@ -2374,7 +2365,6 @@ def add_or_update_expectation_suite( # noqa: PLR0913
id: str | None = None,
expectations: list[dict | ExpectationConfiguration] | None = None,
evaluation_parameters: dict | None = None,
data_asset_type: str | None = None,
execution_engine_type: Type[ExecutionEngine] | None = None,
meta: dict | None = None,
expectation_suite: ExpectationSuite | None = None,
Expand All @@ -2386,7 +2376,6 @@ def add_or_update_expectation_suite( # noqa: PLR0913
id: Identifier to associate with this suite (ignored if updating existing suite).
expectations: Expectation Configurations to associate with this suite.
evaluation_parameters: Evaluation parameters to be substituted when evaluating Expectations.
data_asset_type: Type of Data Asset to associate with this suite.
execution_engine_type: Name of the Execution Engine type.
meta: Metadata related to the suite.
expectation_suite: The `ExpectationSuite` object you wish to persist.
Expand All @@ -2409,7 +2398,6 @@ def add_or_update_expectation_suite( # noqa: PLR0913
id=id,
expectations=expectations,
evaluation_parameters=evaluation_parameters,
data_asset_type=data_asset_type,
execution_engine_type=execution_engine_type,
meta=meta,
)
Expand Down
1 change: 0 additions & 1 deletion tests/checkpoint/cloud_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def _expectation_suite():
"created_by_id": "934e0898-6a5c-4ffd-9125-89381a46d191",
"organization_id": os.environ["GX_CLOUD_ORGANIZATION_ID"],
"suite": {
"data_asset_type": None,
"name": "single-snippet-suite-2",
"expectations": [
{
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,6 @@ def titanic_expectation_suite(empty_data_context_stats_enabled):
return ExpectationSuite(
name="Titanic.warning",
meta={},
data_asset_type="Dataset",
expectations=[
ExpectationConfiguration(
expectation_type="expect_column_to_exist", kwargs={"column": "PClass"}
Expand Down
14 changes: 4 additions & 10 deletions tests/core/test_expectation_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def test_expectation_suite_init_defaults(self, fake_expectation_suite_name: str)
assert suite.name == fake_expectation_suite_name
assert suite.expectations == []
assert suite.evaluation_parameters == {}
assert suite.data_asset_type is None
assert suite.execution_engine_type is None
assert suite.meta == default_meta
assert suite.id is None
Expand All @@ -110,7 +109,6 @@ class DummyExecutionEngine:
pass

test_evaluation_parameters = {"$PARAMETER": "test_evaluation_parameters"}
test_data_asset_type = "test_data_asset_type"
dummy_execution_engine_type = type(DummyExecutionEngine())
default_meta = {"great_expectations_version": ge_version}
test_meta_base = {"test_key": "test_value"}
Expand All @@ -121,7 +119,6 @@ class DummyExecutionEngine:
name=fake_expectation_suite_name,
expectations=[expect_column_values_to_be_in_set_col_a_with_meta],
evaluation_parameters=test_evaluation_parameters,
data_asset_type=test_data_asset_type,
execution_engine_type=dummy_execution_engine_type, # type: ignore[arg-type]
meta=test_meta,
id=test_id,
Expand All @@ -131,7 +128,6 @@ class DummyExecutionEngine:
expect_column_values_to_be_in_set_col_a_with_meta
]
assert suite.evaluation_parameters == test_evaluation_parameters
assert suite.data_asset_type == test_data_asset_type
assert suite.execution_engine_type == dummy_execution_engine_type
assert suite.meta == test_meta
assert suite.id == test_id
Expand Down Expand Up @@ -916,7 +912,6 @@ def test_is_equivalent_to_expectation_suite_classes_true_with_changes_to_non_con
different_but_equivalent_suite = deepcopy(suite_with_single_expectation)
different_but_equivalent_suite.name = "different_name"
different_but_equivalent_suite.meta = {"notes": "Different meta."}
different_but_equivalent_suite.data_asset_type = "different_data_asset_type"
different_but_equivalent_suite.id = "different_id"

assert suite_with_single_expectation.isEquivalentTo(
Expand Down Expand Up @@ -1010,7 +1005,6 @@ def test_expectation_suite_equality_single_expectation_true(
pytest.param(
"evaluation_parameters", {"different": "evaluation_parameters"}
),
pytest.param("data_asset_type", "different_data_asset_type"),
pytest.param(
"execution_engine_type",
type(ExecutionEngine),
Expand Down Expand Up @@ -1216,19 +1210,19 @@ def profiler_config():
def test_expectation_suite_copy(baseline_suite):
suite_copy = copy(baseline_suite)
assert suite_copy == baseline_suite
suite_copy.data_asset_type = "blarg!"
suite_copy.name = "blarg!"
assert (
baseline_suite.data_asset_type != "blarg"
baseline_suite.name != "blarg"
) # copy on primitive properties shouldn't propagate


@pytest.mark.unit
def test_expectation_suite_deepcopy(baseline_suite):
suite_deepcopy = deepcopy(baseline_suite)
assert suite_deepcopy == baseline_suite
suite_deepcopy.data_asset_type = "blarg!"
suite_deepcopy.name = "blarg!"
assert (
baseline_suite.data_asset_type != "blarg"
baseline_suite.name != "blarg"
) # copy on primitive properties shouldn't propagate
suite_deepcopy.expectation_configurations[0].meta["notes"] = "a different note"
# deepcopy on deep attributes does not propagate
Expand Down
1 change: 0 additions & 1 deletion tests/data_asset/test_data_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_data_asset_expectation_suite():
asset = DataAsset()
default_suite = ExpectationSuite(
name="default",
data_asset_type="DataAsset",
meta={"great_expectations_version": ge_version},
expectations=[],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def mock_get_all_suites_json(
"organization_id": "77eb8b08-f2f4-40b1-8b41-50e7fbedcda3",
"rendered_data_doc_id": None,
"suite": {
"data_asset_type": None,
"name": suite_1.name,
"expectations": [
{
Expand Down Expand Up @@ -85,7 +84,6 @@ def mock_get_all_suites_json(
"organization_id": "77eb8b08-f2f4-40b1-8b41-50e7fbedcda3",
"rendered_data_doc_id": None,
"suite": {
"data_asset_type": None,
"name": suite_2.name,
"expectations": [
{
Expand Down Expand Up @@ -143,7 +141,6 @@ def _mocked_get_response(*args, **kwargs):
"created_by_id": "67dce9ed-9c41-4607-9f22-15c14cc82ac0",
"organization_id": "c8f9f2d0-fb5c-464b-bcc9-8a45b8144f44",
"suite": {
"data_asset_type": None,
"name": "my_mock_suite",
"expectations": [
{
Expand Down Expand Up @@ -195,7 +192,6 @@ def _mocked_get_by_name_response(*args, **kwargs):
"created_by_id": "67dce9ed-9c41-4607-9f22-15c14cc82ac0",
"organization_id": "c8f9f2d0-fb5c-464b-bcc9-8a45b8144f44",
"suite": {
"data_asset_type": None,
"name": "my_mock_suite",
"expectations": [
{
Expand Down Expand Up @@ -494,7 +490,6 @@ def test_save_expectation_suite_overwrites_existing_suite(
context.save_expectation_suite(suite)

expected_suite_json = {
"data_asset_type": None,
"name": suite_name,
"expectations": [],
"id": suite_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_cloud_backed_data_context_add_or_update_expectation_suite_include_rende
assert mock_update.call_args[0][1] == {
"expectation_suite_name": "test_suite",
"id": None,
"data_asset_type": None,
"expectations": [
{
"rendered_content": [
Expand Down
1 change: 0 additions & 1 deletion tests/data_context/migrator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ def serialized_configuration_bundle() -> dict:
],
"expectation_suites": [
{
"data_asset_type": None,
"name": "my_suite",
"expectations": [],
"id": None,
Expand Down
1 change: 0 additions & 1 deletion tests/data_context/store/test_validation_config_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def test_add_cloud(
"name": "my_suite",
"id": None,
"expectations": [],
"data_asset_type": None,
"meta": mock.ANY, # GX version information
"notes": None,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
},
],
"expectation_suite_name": "brand new suite",
"data_asset_type": "pandas",
},
"organization_id": EXISTING_ORGANIZATION_ID,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
row_count_rule_suite = """
{
"meta": {"great_expectations_version": "0.16.7"},
"data_asset_type": None,
"expectations": [
{
"kwargs": {"min_value": 10000, "max_value": 10000, "mostly": 1.0},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"data_asset_type": null,
"name": "visitors_exp",
"expectations": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"data_asset_type": null,
"name": "yellow_tripdata_validations",
"expectations": [],
"meta": {
Expand Down
3 changes: 1 addition & 2 deletions tests/render/fixtures/BasicDatasetProfiler_expectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,5 @@
"value_set": null
}
}
],
"data_asset_type": "Dataset"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,5 @@
"value_set": null
}
}
],
"data_asset_type": "Dataset"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "my_dag_node.default",
"data_asset_type": "Dataset",
"meta": {
"great_expectations_version": "0.9.4"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "my_dag_node.default",
"data_asset_type": "Dataset",
"meta": {
"great_expectations_version": "0.9.4"
},
Expand Down

0 comments on commit 5184ea7

Please sign in to comment.