How to update Data Docs after validating a Checkpoint
This guide will explain how to use a Validation Action to update Data Docs sites with new Validation Results from running a Checkpoint.
Prerequisites: This how-to guide assumes you have:
- Completed the Getting Started Tutorial
- Have a working installation of Great Expectations
- Created at least one Expectation Suite.
- Created at least one Checkpoint.
Steps#
Update your Checkpoint
A Checkpoint's
action_listcontains a list of Validation Actions. After the checkpoint is validated, these actions are called in order. Add a Validation Action to the end of theaction_listand name itupdate_data_docs. Validation Actions are required to have a single field,action. Inside of theactionfield, aclass_namefield must be defined, which determines which class will be instantiated to execute this action. Addclass_name: UpdateDataDocsActionto the action.Note:
The
StoreValidationResultActionaction must appear beforeUpdateDataDocsActionaction, since Data Docs are rendered from Validation Results from the store.action_list: - name: store_validation_result action: class_name: StoreValidationResultAction - name: store_evaluation_params action: class_name: StoreEvaluationParametersAction - name: update_data_docs action: class_name: UpdateDataDocsActionSpecify Data Docs sites (optional):
- By default, the
UpdateDataDocsActionupdates all Data Docs sites found within your project. To specify which Data Docs sites to update, provide asite_nameskey to theactionconfig inside yourUpdateDataDocsAction. This field accepts a list of Data Docs site names, and when provided, will only update the specified sites.
action_list: - name: store_validation_result action: class_name: StoreValidationResultAction - name: store_evaluation_params action: class_name: StoreEvaluationParametersAction - name: update_data_docs action: class_name: UpdateDataDocsAction site_names: - team_site- By default, the
Test your configuration.
Test that your new Validation Action is configured correctly:
- Run the Checkpoint from your code or the CLI and verify that no errors are thrown.
import great_expectations as gecontext = ge.get_context()checkpoint_name = "your checkpoint name here"context.run_checkpoint(checkpoint_name=checkpoint_name)$ great_expectations checkpoint run <your checkpoint name>- Check your Data Docs sites to confirm that a new Validation Result has been added.
Additional notes#
The UpdateDataDocsAction generates an HTML file for the latest Validation Result and updates the index page to link to the new file, and re-renders pages for the suite used for that validation. It does not perform a full rebuild of Data Docs sites. This means that if you wish to render older Validation Results, you should run full Data Docs rebuild (via CLI's great_expectations docs build command or by calling context.build_data_docs()).