Skip to main content
Version: 0.18.9

EmailAction

class great_expectations.checkpoint.EmailAction(data_context: AbstractDataContext, renderer: dict, smtp_address: str, smtp_port: str, sender_login: str, sender_password: str, receiver_emails: str, sender_alias: Optional[str] = None, use_tls: Optional[bool] = None, use_ssl: Optional[bool] = None, notify_on: str = 'all', notify_with: Optional[list[str]] = None)#

Sends an email to a given list of email addresses.

- name: send_email_on_validation_result
action:
class_name: EmailAction
notify_on: all # possible values: "all", "failure", "success"
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.email_renderer
class_name: EmailRenderer
# put the actual following information in the uncommitted/config_variables.yml file
# or pass in as environment variable
smtp_address: ${smtp_address}
smtp_port: ${smtp_port}
sender_login: ${email_address}
sender_password: ${sender_password}
sender_alias: ${sender_alias} # useful to send an email as an alias
receiver_emails: ${receiver_emails}
use_tls: False
use_ssl: True

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

  • renderer – Specifies the renderer used to generate an email, for example:

                 {
"module_name": "great_expectations.render.renderer.email_renderer",
"class_name": "EmailRenderer",
}

:param smtp_address: Address of the SMTP server used to send the email. :param smtp_address: Port of the SMTP server used to send the email. :param sender_login: Login used send the email. :param sender_password: Password used to send the email. :param sender_alias: Optional. Alias used to send the email (default = sender_login). :param receiver_emails: Email addresses that will receive the email (separated by commas). :param use_tls: Optional. Use of TLS to send the email (using either TLS or SSL is highly recommended). :param use_ssl: Optional. Use of SSL to send the email (using either TLS or SSL is highly recommended). :param notify_on: "Specifies validation status that triggers notification. One of "all", "failure", "success". :param notify_with: Optional list of DataDocs site names to display in Slack messages. Defaults to all.

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.