Check

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:

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:

Multiple Condition Check

Validate multiple conditions before starting replication:

Data Quality Threshold Check

Verify that the error rate in processed data is below a threshold:

Time Window Validation

Ensure replication runs within specific time windows:

Complex Business Rule Validation

Implement complex business rules with multiple conditions:

Environment-Based Validation

Apply different validation rules based on the environment:

Resource Usage Check

Validate system resource availability before proceeding:

Data Freshness Check

Ensure source data is fresh enough before replication:

Last updated

Was this helpful?