Skip to main content
Version: 0.18.21

ExpectationSuite

class great_expectations.core.ExpectationSuite(expectation_suite_name: str, data_context: Optional[AbstractDataContext] = None, expectations: Optional[Sequence[Union[dict, ExpectationConfiguration]]] = None, evaluation_parameters: Optional[dict] = None, data_asset_type: Optional[str] = None, execution_engine_type: Optional[Type[ExecutionEngine]] = None, meta: Optional[dict] = None, ge_cloud_id: Optional[str] = None)#

Suite of expectations plus create, read, update, and delete functionality.

  • create: add_expectation(), append_expectation()

  • read: find_expectation_indexes(), find_expectations(), show_expectations_by_domain_type(), show_expectations_by_expectation_type()

  • update: add_expectation(), append_expectation(), patch_expectation(), replace_expectation(), add_expectation_configurations()

  • delete: remove_expectation(), remove_all_expectations_of_type()

Parameters
  • expectation_suite_name – Name of the Expectation Suite.

  • data_context – Data Context associated with this 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.

  • Deprecated since version 0.14.0.

  • execution_engine_type – Name of the execution engine type.

  • meta – Metadata related to the suite.

  • ge_cloud_id – Great Expectations Cloud id for this Expectation Suite.

  • New in version 0.13.33: Used in GX Cloud deployments.

add_expectation(expectation_configuration: great_expectations.core.expectation_configuration.ExpectationConfiguration, send_usage_event: bool = True, match_type: str = 'domain', overwrite_existing: bool = True) great_expectations.core.expectation_configuration.ExpectationConfiguration#

Upsert specified ExpectationConfiguration into this ExpectationSuite.

Parameters
  • expectation_configuration – The ExpectationConfiguration to add or update.

  • send_usage_event – Whether to send a usage_statistics event. When called through ExpectationSuite class’ public add_expectation() method, this is set to True.

  • match_type – The criteria used to determine whether the Suite already has an ExpectationConfiguration and so whether we should add or replace.

  • overwrite_existing – If the expectation already exists, this will overwrite if True and raise an error if False.

Returns

The ExpectationConfiguration to add or replace.

Raises
  • ValueError – More than one match

  • DataContextError – One match if overwrite_existing = False

# noqa: DAR402

find_expectations(expectation_configuration: Optional[great_expectations.core.expectation_configuration.ExpectationConfiguration] = None, match_type: str = 'domain', ge_cloud_id: Optional[str] = None) List[great_expectations.core.expectation_configuration.ExpectationConfiguration]#

Find Expectations matching the given ExpectationConfiguration on the given match_type. If a ge_cloud_id is provided, match_type is ignored and only Expectations with matching ge_cloud_id are returned.

Parameters
  • expectation_configuration – A potentially incomplete (partial) Expectation Configuration to match against to find the index of any matching Expectation Configurations on the suite.

  • match_type

    This determines what kwargs to use when matching. Options are ‘domain’ to match based on the data evaluated by that expectation, ‘success’ to match based on all configuration parameters

  • that influence whether an expectation succeeds based on a given batch of data, and ‘runtime’ to match based on all configuration parameters

  • ge_cloud_id – Great Expectations Cloud id

Returns: A list of matching ExpectationConfigurations

remove_expectation(expectation_configuration: Optional[great_expectations.core.expectation_configuration.ExpectationConfiguration] = None, match_type: str = 'domain', remove_multiple_matches: bool = False, ge_cloud_id: Optional[Union[str, uuid.UUID]] = None) List[great_expectations.core.expectation_configuration.ExpectationConfiguration]#

Remove an ExpectationConfiguration from the ExpectationSuite.

Parameters
  • expectation_configuration – A potentially incomplete (partial) Expectation Configuration to match against.

  • match_type – This determines what kwargs to use when matching. Options are ‘domain’ to match based on the data evaluated by that expectation, ‘success’ to match based on all configuration parameters that influence whether an expectation succeeds based on a given batch of data, and ‘runtime’ to match based on all configuration parameters.

  • remove_multiple_matches – If True, will remove multiple matching expectations.

  • ge_cloud_id

    Great Expectations Cloud id for an Expectation.

  • New in version 0.13.33: Used in cloud deployments.

Returns

The list of deleted ExpectationConfigurations.

Raises
  • TypeError – Must provide either expectation_configuration or ge_cloud_id.

  • ValueError – No match or multiple matches found (and remove_multiple_matches=False).

show_expectations_by_domain_type() None#

Displays “ExpectationConfiguration” list, grouped by “domain_type”, in predetermined designated order.

The means of displaying is through the use of the “Pretty Print” library method “pprint.pprint()”.

to_json_dict() Dict[str, JSONValues]#

Returns a JSON-serializable dict representation of this ExpectationSuite.

Returns

A JSON-serializable dict representation of this ExpectationSuite.