Skip to main content
Version: 0.17.19

SlackNotificationAction

class great_expectations.checkpoint.SlackNotificationAction(data_context: AbstractDataContext, renderer: dict, slack_webhook: Optional[str] = None, slack_token: Optional[str] = None, slack_channel: Optional[str] = None, notify_on: str = 'all', notify_with: Optional[list[str]] = None, show_failed_expectations: bool = False)#

Sends a Slack notification to a given webhook.

- name: send_slack_notification_on_validation_result
action:
class_name: SlackNotificationAction
# put the actual webhook URL in the uncommitted/config_variables.yml file
# or pass in as environment variable
# use slack_webhook when not using slack bot token
slack_webhook: ${validation_notification_slack_webhook}
slack_token:
slack_channel:
notify_on: all
notify_with:
renderer:
# the class that implements the message to be sent
# this is the default implementation, but you can
# implement a custom one
module_name: great_expectations.render.renderer.slack_renderer
class_name: SlackRenderer
show_failed_expectations: True

Parameters:
  • data_context – Data Context that is used by the Action.

  • renderer – Specifies the Renderer used to generate a query consumable by Slack API, e.g.:

                  {
"module_name": "great_expectations.render.renderer.slack_renderer",
"class_name": "SlackRenderer",
}
:param slack_webhook: The incoming Slack webhook to which to send notification. :param slack_token: Token from Slack app. Used when not using slack_webhook. :param slack_channel: Slack channel to receive notification. Used when not using slack_webhook. :param notify_on: Specifies validation status that triggers notification. One of "all", "failure", "success". :param notify_with: List of DataDocs site names to display in Slack messages. Defaults to all. :param show_failed_expectations: Shows a list of failed expectation types.

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.