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 already:
Set up an
ActionListValidationOperator
orSet up a
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.
Steps¶
Update 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
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 guide.Run the Checkpoint and verify that no errors are thrown. You can run the Checkpoint from the CLI as explained here or from Python, as explained here.
Check your configured 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()
).