Check hooks allow you to validate conditions and control the flow of your replication process. They are useful for implementing data quality checks, validating prerequisites, and ensuring business rules are met.
Configuration
- type: check
check: "run.total_rows > threshold" # Required: The condition to evaluate
failure_message: '{run.total_rows} is below threshold' # Optional: the message to use as an error
vars: # Optional: Local variables for the check
threshold: 1000
min_date: "2023-01-01"
on_failure: abort # Optional: abort/warn/quiet/skip
id: my_id # Optional. Will be generated. Use `log` hook with {runtime_state} to view state.
Properties
Property
Required
Description
check
Yes
The condition to evaluate
failure_message
No
A Message to use as the error if check fails
vars
No
Map of scoped variables that can be used in the check
on_failure
No
What to do if the check fails (abort/warn/quiet/skip)
Output
When the check hook executes successfully, it returns the following output that can be accessed in subsequent hooks:
status: success # Status of the hook execution
failure_message: message # The rendered message
result: true # The result of the check evaluation (true/false)
You can access these values in subsequent hooks using the following syntax (jmespath):
{state.hook_id.check} - the compiled expresion to check
{state.hook_id.status} - Status of the hook execution
{state.hook_id.result} - Boolean result of the check
Examples
Basic Row Count Validation
Ensure that the replication processed a minimum number of rows: