Skip to main content
Version: 0.18.9

Use Data Docs URLs in custom Validation Actions

To create a custom Validation Action that includes a link to the Data DocsHuman readable documentation generated from Great Expectations metadata detailing Expectations, Validation Results, etc., you get the Data Docs URL for the Validation ResultsGenerated when data is Validated against an Expectation or Expectation Suite. page from your Validation Results after you run a CheckpointThe primary means for validating data in a production deployment of Great Expectations.. This method returns the URLs for any type of Data Docs site setup including S3 or a local setup.

The code used in this topic is available on GitHub here: actions.py

Prerequisites

Instantiate

First, within the _run method of your custom Validation Action, instantiate an empty dict to hold your sites:

Python
data_docs_validation_results: dict = {}

Acquire

Next, call get_docs_sites_urls to get the urls for all the suites processed by this Checkpoint:

Python
docs_site_urls_list = self.data_context.get_docs_sites_urls(
resource_identifier=validation_result_suite_identifier,
site_names=self._site_names, # type: ignore[arg-type] # could be a `str`
)

Iterate

The above step returns a list of dictionaries containing the relevant information. Now, we need to iterate through the entries to build the object we want:

Python
for sites in docs_site_urls_list:
data_docs_validation_results[sites["site_name"]] = sites["site_url"]

Utilize

You can now include the urls contained within the data_docs_validation_results dictionary as links in your custom notifications, for example in an email, Slack, or OpsGenie notification, which will allow users to jump straight to the relevant Validation Results page.

Congratulations!
🎉 You've just accessed Data Docs URLs for use in custom Validation Actions! 🎉