How to update Data Docs as a Validation Action
This guide will explain how to use a Validation Action to update Data Docs sites with new Validation Results from Validation Operator runs.
Prerequisites: This how-to guide assumes you have:
- Completed the Getting Started Tutorial
- Have a working installation of Great Expectations
- Set up a
.py
class:great_expectations.validation_operators.validation_operators.ActionListValidationOperator
or - Set up a
.py
class:great_expectations.validation_operators.validation_operators.WarningAndFailureExpectationSuitesValidationOperator
- Created at least one Expectation Suite.
- Created at least one Checkpoint. You will need it in order to test that your new Validation Operator is working.
#
StepsUpdate the action_list key in your Validation Operator config.
Add the
UpdateDataDocsAction
action to theaction_list
key of theActionListValidationOperator
orWarningAndFailureExpectationSuitesValidationOperator
config in yourgreat_expectations.yml
. This action will update all configured Data Docs sites with the new validation from the Validation Operator run.Note:
The
StoreValidationResultAction
action must appear before this action, since Data Docs are rendered from Validation Results from the store.validation_operators: action_list_operator: # this is a user-selected name class_name: ActionListValidationOperator action_list: - name: store_validation_result # this is a user-selected name action: class_name: StoreValidationResultAction - name: update_data_docs # this is a user-selected name action: class_name: UpdateDataDocsAction
If you only want to update certain configured Data Docs sites:
- Add a
site_names
key to theUpdateDataDocsAction
config.
validation_operators: action_list_operator: # this is a user-selected name class_name: ActionListValidationOperator action_list: - name: store_validation_result # this is a user-selected name action: class_name: StoreValidationResultAction - name: update_data_docs # this is a user-selected name action: class_name: UpdateDataDocsAction site_names: - team_site
- Add a
Test your configuration.
Test that your new Validation Operator Action is configured correctly:
- Open the configuration file of a Checkpoint you created earlier and replace the value of
validation_operator_name
with the name of the Validation Operator you added theUpdateDataDocs
action to. The details of Checkpoint configuration can be found in this How to add validations data or suites to a Checkpoint. - Run the Checkpoint and verify that no errors are thrown. You can run the Checkpoint from the CLI or using Python as explained in How to validate your data using a Checkpoint.
- Check your configured Data Docs sites to confirm that a new Validation Result has been added.
- Open the configuration file of a Checkpoint you created earlier and replace the value of
#
Additional notesThe 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()
).