Skip to main content
Version: 1.2.3

Run a Validation Definition

Prerequisites

Procedure

  1. Retrieve your Validation Definition.

    If you have created a new Validation Definition you can use the object returned by your Data Context's .validation_definitions.add(...) method. Alternatively, you can retrieve a previously configured Validation Definition by updating the variable validation_definition_name in the following code and executing it:

    Python name=
    validation_definition_name = "my_validation_definition"
    validation_definition = context.validation_definitions.get(validation_definition_name)
  2. Execute the Validation Definition's run() method:

    Python
    validation_results = validation_definition.run()

    Validation Results are automatically saved in your Data Context when a Validation Definition's run() method is called. For convenience, the run() method also returns the Validation Results as an object you can review.

    Result verbosity

    You can set the level of detail returned in a Validation Definition's results by passing a Result Format configuration as the result_format parameter of your Validation Definition's run(...) method. For more information on Result Formats, see Choose a result format.

  3. Review the Validation Results:

    Python
    print(validation_results)

    When you print the returned Validation Result object you will recieve a json representation of the results. By default this will include a "results" list that includes each Expectation in your Validation Definition's Expectation Suite, whether the Expectation was successfully met or failed to pass, and some sumarized information explaining the why the Expectation succeeded or failed.

    Result presentation

    When using a GX Cloud Data Context, you can view the Validation Results in the GX Cloud UI by following the url provided with:

    Python
    print(validation_results.result_url)