Skip to main content
Version: 0.16.16

How to create a new Checkpoint

This guide will help you create a new CheckpointThe primary means for validating data in a production deployment of Great Expectations., which allows you to couple an Expectation SuiteA collection of verifiable assertions about data. with a data set to ValidateThe act of applying an Expectation Suite to a Batch..

Prerequisites

Steps

1. Create a Checkpoint

In this guide, we will use the SimpleCheckpoint class, which takes care of some defaults.

To modify this code sample for your use case, replace the batch_request and expectation_suite_name with your own.

checkpoint = gx.checkpoint.SimpleCheckpoint(
name="my_checkpoint",
data_context=context,
validations=[
{
"batch_request": batch_request,
"expectation_suite_name": "my_expectation_suite",
},
],
)

Note: There are other configuration options for more advanced deployments, please refer to How to configure a new Checkpoint using test_yaml_config for more details.

2. (Optional) Run your Checkpoint

checkpoint_result = checkpoint.run()

The returned checkpoint_result contains information about the checkpoint run.

3. (Optional) Build Data Docs

You can build Data DocsHuman readable documentation generated from Great Expectations metadata detailing Expectations, Validation Results, etc. with the latest checkpoint run result included by running:

context.build_data_docs()

4. (Optional) Store your Checkpoint

If you want to store your Checkpoint for later use:

context.add_checkpoint(checkpoint=checkpoint)

And retrieve via the name we set earlier:

retrieved_checkpoint = context.get_checkpoint(name="my_checkpoint")

Additional Resources