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
You have set up your environment and the GX Agent is running.
You have a Data Asset.
You have created an Expectation.
Add a Checkpoint
In Jupyter Notebook, run the following code to import the
great_expectations
module and the existing Data Context:Jupyter Notebookimport great_expectations as gx
context = gx.get_context()Run the following code to retrieve the Expectation Suite:
Jupyter Notebookexpectation_suite = context.get_expectation_suite(expectation_suite_name=<expectation_name>)
Run the following code to assign a name to the Checkpoint:
Jupyter Notebookcheckpoint_name = <checkpoint_name>
Run the following code to define the Checkpoint configuration.
Jupyter Notebookcheckpoint_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
anddata_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.Run the following code to add the Checkpoint:
Jupyter Notebookcheckpoint = context.add_or_update_checkpoint(**checkpoint_config)
Optional. Run the following code to confirm the Checkpoint name:
Jupyter Notebookprint(checkpoint)
Optional. Run the following code to run the Checkpoint:
Jupyter Notebookresult = checkpoint.run()
Run a Checkpoint
In GX Cloud, click Checkpoints.
Optional. To run a Checkpoint on a failing Checkpoint, click Failures Only.
Optional. To run a specific Checkpoint, select it in the Checkpoints pane.
Click Run Checkpoint for the Checkpoint you want to run.
Edit a Checkpoint name
In GX Cloud, click Checkpoints.
Click Edit Checkpoint in the Checkpoints list for the Checkpoint you want to edit.
Enter a new name for the Checkpoint and then click Save.
Update the Checkpoint name in all code that included the previous Checkpoint name.
Edit a Checkpoint configuration
In Jupyter Notebook, run the following code to import the
great_expectations
module and the existing Data Context:Jupyter Notebookimport great_expectations as gx
context = gx.get_context()Run the following Python code to retrieve the Checkpoint:
Jupyter Notebookretrieved_checkpoint = context.get_checkpoint(name="<checkpoint_name>")
Edit the Checkpoint configuration.
Run the following code to update the Checkpoint configuration:
Jupyter Notebookcheckpoint = context.add_or_update_checkpoint(**checkpoint_config)
Delete a Checkpoint
In GX Cloud, click Checkpoints.
Click Delete Checkpoint for the Checkpoint you want to delete.
Click Delete.