This guide will help you create a new Checkpoint, which allows you to couple an Expectation Suite with a data set to validate.
Note: As of Great Expectations version 0.13.7, we have updated and improved the Checkpoints feature. You can continue to use your existing legacy Checkpoint workflows if you’re working with concepts from the Batch Kwargs (v2) API. If you’re using concepts from the BatchRequest (v3) API, please refer to the new Checkpoints guides.
This how-to guide assumes you have already:
great_expectations --v3-api checkpoint new my_checkpoint
Within this notebook, you will have the opportunity to create your own yaml Checkpoint configuration. The following text walks through an example.
For this example, we’ll demonstrate using a basic Checkpoint configuration with the
SimpleCheckpoint class, which takes care of some defaults. Replace all names such as
my_datasource with the respective DataSource, DataConnector, DataAsset, and Expectation Suite names you have configured in your
config = """name: my_checkpointconfig_version: 1class_name: SimpleCheckpointvalidations: - batch_request:datasource_name: my_datasourcedata_connector_name: my_data_connectordata_asset_name: MyDataAssetdata_connector_query: index: -1expectation_suite_name: my_suite"""
This is the minimum required to configure a Checkpoint that will run the Expectation Suite
my_suite against the data asset
MyDataAsset. See How to configure a new Checkpoint using test_yaml_config for advanced configuration options.
2b. Test your config using
When executed, test_yaml_config will instantiate the component and run through a self_check procedure to verify that the component works as expected.
In the case of a Checkpoint, this means
- validating the yaml configuration,
- verifying that the Checkpoint class with the given configuration, if valid, can be instantiated, and
- printing warnings in case certain parts of the configuration, while valid, may be incomplete and need to be better specified for a successful Checkpoint operation.
The output will look something like this:
Attempting to instantiate class from config...Instantiating as a SimpleCheckpoint, since class_name is SimpleCheckpointSuccessfully instantiated SimpleCheckpoint Checkpoint class name: SimpleCheckpoint
If something about your configuration wasn’t set up correctly,
test_yaml_config will raise an error.
After you are satisfied with your configuration, save it by running the appropriate cells in the Jupyter Notebook.
If the Store Backend of your Checkpoint Store is on the local filesystem, you can navigate to the
checkpoints store directory that is configured in
great_expectations.yml and find the configuration files corresponding to the Checkpoints you created.
Now that you have stored your Checkpoint configuration to the Store backend configured for the Checkpoint Configuration store of your Data Context, you can also test
context.run_checkpoint, right within your Jupyter Notebook by running the appropriate cells.
Before running a Checkpoint, make sure that all classes and Expectation Suites referred to in the configuration exist.
run_checkpoint returns, the
checkpoint_run_result can then be checked for the value of the
success field (all validations passed) and other information associated with running the specified actions.
For more advanced configurations of Checkpoints, please see How to configure a new Checkpoint using test_yaml_config.