Skip to main content
Version: 0.16.16

How to get Data Docs URLs for use in custom Validation Actions

If you would like to a custom Validation Action that includes a link to Data DocsHuman readable documentation generated from Great Expectations metadata detailing Expectations, Validation Results, etc., you can access the Data Docs URL for the respective Validation ResultsGenerated when data is Validated against an Expectation or Expectation Suite. page from your Validation Results following a CheckpointThe primary means for validating data in a production deployment of Great Expectations. run following the steps below.

This will work to get the URLs for any type of Data Docs site setup. For example, S3 or a local setup.

Prerequisites

1. Instantiate

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

data_docs_validation_results: dict = {}

2. Acquire

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

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`
)

3. 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:

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

4. 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! 🎉

note

For more on Validation Actions, see our current guides on Validation Actions here.

To view the full script used in this page, and see this process in action, see it on GitHub: