Action
An Action is a Python class with a run()
method that takes a Validation ResultGenerated when data is Validated against an Expectation or Expectation Suite. and does something with it.
Actions are customizable. Great Expectations comes with common Actions for such things as sending email or Slack notifications, updating Data DocsHuman readable documentation generated from Great Expectations metadata detailing Expectations, Validation Results, etc., and storing Validation ResultsGenerated when data is Validated against an Expectation or Expectation Suite. out of the box. However, it is easy to create custom Actions by creating a subclass of Great Expectations' ValidationAction
class and overwriting its _run()
method. This means that you can configure an Action to do literally anything you are capable of programming in Python in response to a CheckpointThe primary means for validating data in a production deployment of Great Expectations. ValidationThe act of applying an Expectation Suite to a Batch. completing.
Relationship to other objects
Actions are configured inside the action_list
parameter of a Checkpoint's configuration, and execute every time the Checkpoint finishes running a Validation. When an Action is run, it will have access to the Validation Results and configured MetricsA computed attribute of data such as the mean of a column. that were generated by the Checkpoint.
Use cases
Configuring, implementing, and executing an Action (custom or otherwise) takes place in the Validate Data step. Creating custom Actions is a process that falls outside the workflow of using Great Expectations.
Actions are configured when Checkpoints are created in the Validate Data step of working with Great Expectations. After that, Checkpoints that have a populated action_list
in their configuration will execute the indicated Actions every time they finish running a Validation.
Versatility
The features of a specific Action depend on what that Action is designed to do. An Action can perform anything that can be done with Python code, making them phenomenally versatile.
Convenience
Since some Actions are common, Great Expectations implements them out of the box: You don't have to write every Action as a custom one. These Actions are subclasses of the ValidationAction
class, and you can view them in the great_expectations.checkpoint.actions module.
The following are some of the available pre-built Actions:
EmailAction
: sends an email to a given list of email addresses.MicrosoftTeamsNotificationAction
: sends a Microsoft Teams notification to a given webhook.SlackNotificationAction
: sends a Slack notification to a given webhook.StoreEvaluationParametersAction
: extracts Evaluation Parameters from a Validation Result and stores them in the Store configured for this Action.StoreMetricsAction
: extracts Metrics from a Validation Result and stores them in a Metrics Store.StoreValidationResultAction
: stores a Validation Result in theValidationsStore
.UpdateDataDocsAction
: notifies the site builders of all the data docs sites of the Data Context that a validation result should be added to the data docs.