Validation and auto-repair
Automatic repair policy
Let scheduled compares repair the drift they confirm, for one table or for every table and target, within a key limit you set.
An automatic repair policy lets a scheduled compare request key repairs for the drift it confirms, without an operator. It works for every source, capture mode and target. The policy is part of the pipeline's compare schedule: you set it on the Compare tab or with the CLI.
Before you begin
- Scheduled compare is on. The policy is inactive while scheduled compares are off.
Choose a scope
| Scope | What is compared and repaired | Key limit |
|---|---|---|
| One table | The scheduled compare of the primary target. Only the named table's drift is repaired. | If the table's drift needs more keys than the limit, nothing is repaired. |
| All selected tables | Every selected table, on every target. | The keys are repaired in commands of at most that many keys each, one after another. |
The key limit is required and must be from 1 to 1,000. With the all-tables scope, a paused target keeps the repair cycle from completing until you resume it.
Set the policy
On the Compare tab
- Open the pipeline's Compare tab.
- Under Scheduled compare, choose the scope: one table, or all selected tables.
- Enter the key limit, then save the schedule.
With the CLI
sqlflow pipeline compare-schedule sets the policy together with the schedule: the scope, the table for the one-table scope, and the key limit. Without policy options, the command changes only the schedule and keeps the policy.
If the policy is refused
The Compare tab and the CLI show the reason:
| Refusal | Cause |
|---|---|
repair.maximumKeys must be between 1 and 1000 | The key limit is missing or out of range. |
repair.table must name one selected source table | No table is named for the one-table scope. |
repair.table must identify exactly one selected source table | The table isn't selected in the pipeline, or the name matches more than one table. |
all-selected requires a nonempty selected table inventory | The all-tables scope was chosen for a pipeline that selects no tables. |
intervalMinutes must be between 15 and 43200. | The interval is out of range. |
When a repair runs
A repair is requested only after a scheduled compare that compared every selected table in full and ended with the verdict drift, with no rows left in flight and no table refused. A manual compare never triggers an automatic repair.
Each repair must report verified completion before the next scheduled compare starts. Until then, the schedule skips with "The previous scheduled repair has not reported verified completion." If an operator's repair of the same table is running, the automatic repair waits briefly, then gives up without changing the table.
With the all-tables scope, the run detail shows the repair cycle's state: comparing, repairing, then completed or blocked.
With the one-table scope, SQL Flow also repairs, by key, a batch of that table that fails to apply at a target, within the same key limit. The Tables tab shows the phase "repairing retained apply debt".
An automatic repair never resyncs a table. A table whose row list was cut short needs a manual resync.
See the policy
Under Scheduled compare, the Compare tab describes the current policy:
| Shown text | Meaning |
|---|---|
| "Automatic key repair: dbo.Orders, up to 500 keys based on the primary compare." | One-table policy, active. |
| "Automatic key repair: all selected tables and SQL targets, up to 200 keys per command." | All-tables policy, active. |
| "Automatic key repair is inactive while scheduled compare is disabled. Retained policy: …" | A policy is set, but scheduled compares are off. |
| "Automatic key repair is not configured. Scheduled compares detect differences without requesting repairs." | No policy. |
Alerts
| Alert | Raised when |
|---|---|
| Scheduled key repair skipped (warning) | A scheduled compare's drift can't be repaired automatically, for example because it needs more keys than the limit. The alert gives the reason. |
| Scheduled key repair not completed (warning) | The repair couldn't finish. The alert says why. |
Both alerts are also sent to your notification channels. See Alerts.
