Skip to main content
Version: 0.18.9

Manage Checkpoints

A Checkpoint validates Expectation Suite data. After you create a Checkpoint to validate data, you can save and reuse the Checkpoint.

To learn more about Checkpoints, see Checkpoint.

Prerequisites

Add a Checkpoint

  1. Run the following code to import the great_expectations module and the existing Data Context:

    Python
    import great_expectations as gx
    context = gx.get_context()
  2. Run the following code to retrieve the Expectation Suite:

    Python
    expectation_suite = context.get_expectation_suite(expectation_suite_name=<expectation_name>)
  3. Run the following code to assign a name to the Checkpoint:

    Python
    checkpoint_name = <checkpoint_name> 
  4. Run the following code to define the Checkpoint configuration.

    Python
    checkpoint_config = {
    "name": checkpoint_name,
    "validations": [{
    "expectation_suite_name": expectation_suite.expectation_suite_name,
    "expectation_suite_ge_cloud_id": expectation_suite.ge_cloud_id,
    "batch_request": {
    "datasource_name": "<data_source_name>",
    "data_asset_name": "<data_asset_name>",
    },
    }],
    }

    Replace data_source_name and data_asset_name with the names of an existing Data Source and Data Asset. If you haven't connected to a Data Source and created a Data Asset, see Manage Data Assets.

  5. Run the following code to add the Checkpoint:

    Python
    checkpoint = context.add_or_update_checkpoint(**checkpoint_config) 
  6. Optional. Run the following code to confirm the Checkpoint name:

    Python
    print(checkpoint) 
  7. Optional. Run the following code to run the Checkpoint:

    Python
    result = checkpoint.run() 

Run a Checkpoint

  1. In GX Cloud, click Checkpoints.

  2. Optional. To run a Checkpoint on a failing Checkpoint, click Failures Only.

  3. Optional. To run a specific Checkpoint, select it in the Checkpoints pane.

  4. Click Run Checkpoint for the Checkpoint you want to run.

Add a Validation to a Checkpoint

Add validation data to a Checkpoint to aggregate individual Expectation Suite or Data Source Validations into a single Checkpoint. For more information, see Add Validation data or Expectation Suites to a Checkpoint in the GX OSS documentaion.

  1. In GX Cloud, click Checkpoints.

  2. Click Edit Checkpoint in the Checkpoints list for the Checkpoint you want to add the Validation.

  3. Copy the code snippet and then close the Edit Checkpoint dialog.

  4. Paste the code snippet into a Python interpreter and then add the following code block:

    Python
        validations = [
    {
    "batch_request": {
    "datasource_name": "your_datasource_name",
    "data_asset_name": "your_data_asset_name",
    },
    "expectation_suite_name": "your.expectation.suite.name",
    },
    ]

    Replace your_datasource_name, your_data_asset_name, and your.expectation.suite.name with your own values.

  5. Optional. Repeat step 4 to add additional Validations.

  6. Run the following code to update the Checkpoint configuration:

    Python
    checkpoint = context.add_or_update_checkpoint(**checkpoint_config) 

Edit a Checkpoint name

  1. In GX Cloud, click Checkpoints.

  2. Click Edit Checkpoint in the Checkpoints list for the Checkpoint you want to edit.

  3. Enter a new name for the Checkpoint and then click Save.

  4. Update the Checkpoint name in all code that included the previous Checkpoint name.

Edit a Checkpoint configuration

  1. Run the following code to import the great_expectations module and the existing Data Context:

    Python
    import great_expectations as gx
    context = gx.get_context()
  2. In GX Cloud, click Checkpoints.

  3. Click Edit Checkpoint in the Checkpoints list for the Checkpoint you want to edit.

  4. Copy the code snippet and then close the Edit Checkpoint dialog.

  5. Paste the the code snippet into a Python interpreter and then edit the Checkpoint configuration.

  6. Run the following code to update the Checkpoint configuration:

    Python
    checkpoint = context.add_or_update_checkpoint(**checkpoint_config) 

Configure the Checkpoint result format parameter

You can use the result_format parameter to define the level of detail you want returned with your Validation Results. For example, you can return a success or failure message, a summary of observed values, a list of failing values, or you can add a query or a filter function that returns all failing rows. For more information, see Result format.

Run the following code to apply result_format to every Expectation in a Suite:

Python
checkpoint: Checkpoint = Checkpoint(
name="my_checkpoint",
run_name_template="%Y%m%d-%H%M%S-my-run-name-template",
data_context=context,
batch_request=my_batch_request,
expectation_suite_name="test_suite",
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"}},
],
runtime_configuration={
"result_format": {
"result_format": "COMPLETE",
"unexpected_index_column_names": ["pk_column"],
"return_unexpected_index_query": True,
},
},
)

Replace my_checkpoint and test_suite with your own values. You define your Checkpoint configuration below the runtime_configuration key. The results are stored in the Validation Result after you run the Checkpoint.

Delete a Checkpoint

  1. In GX Cloud, click Checkpoints.

  2. Click Delete Checkpoint for the Checkpoint you want to delete.

  3. Click Delete.