Skip to main content
Version: 0.18.17

StoreMetricsAction

class great_expectations.checkpoint.StoreMetricsAction(data_context: AbstractDataContext, requested_metrics: dict, target_store_name: Optional[str] = 'metrics_store')#

Extract metrics from a Validation Result and store them in a metrics store.

Typical usage example:

    - name: store_evaluation_params
action:
class_name: StoreMetricsAction
# the name must refer to a store that is configured in the great_expectations.yml file
target_store_name: my_metrics_store
Parameters
  • data_context – GX Data Context.

  • requested_metrics

    Dictionary of metrics to store.

  • Dictionary should have the following structure:

                                  expectation_suite_name:
metric_name:
- metric_kwargs_id

You may use "*" to denote that any expectation suite should match.

Parameters

target_store_name – The name of the store where the action will store the metrics.

Raises
  • DataContextError – Unable to find store in your DataContext configuration.

  • DataContextError – StoreMetricsAction must have a valid MetricsStore for its target store.

  • TypeError – validation_result_id must be of type ValidationResultIdentifier or GeCloudIdentifier, not .

run(validation_result_suite: ExpectationSuiteValidationResult, validation_result_suite_identifier: Union[ValidationResultIdentifier, GXCloudIdentifier], data_asset, expectation_suite_identifier: Optional[ExpectationSuiteIdentifier] = None, checkpoint_identifier=None, **kwargs)#

Public entrypoint GX uses to trigger a ValidationAction.

When a ValidationAction is configured in a Checkpoint, this method gets called after the Checkpoint produces an ExpectationSuiteValidationResult.

Parameters
  • validation_result_suite – An instance of the ExpectationSuiteValidationResult class.

  • validation_result_suite_identifier – an instance of either the ValidationResultIdentifier class (for open source Great Expectations) or the GXCloudIdentifier (from Great Expectations Cloud).

  • data_asset – An instance of the Validator class.

  • expectation_suite_identifier – Optionally, an instance of the ExpectationSuiteIdentifier class.

  • checkpoint_identifier – Optionally, an Identifier for the Checkpoint.

  • kwargs – named parameters that are specific to a given Action, and need to be assigned a value in the Action's configuration in a Checkpoint's action_list.

Returns

A Dict describing the result of the Action.