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:

Steps

  1. Update the action_list key in your Validation Operator config.

Add the UpdateDataDocsAction action to the action_list key of the ActionListValidationOperator or WarningAndFailureExpectationSuitesValidationOperator config in your great_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
  1. If you only want to update certain configured Data Docs sites:

  • Add a site_names key to the UpdateDataDocsAction 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
  1. Test your configuration.

    Test that your new Validation Operator Action is configured correctly:

    1. 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 the UpdateDataDocs action to. The details of Checkpoint configuration can be found in this guide.

    2. 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.

    3. 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()).

Additional resources

Comments