Batch pipelines and scheduling
Author, schedule, and operate batch pipelines that move rows from source connections into ClickHouse.
What this page does for you
You have a source connection and a ClickHouse warehouse. A pipeline is the contract that binds them: “table X from connection Y, into target Z, on this schedule, in this mode.” This page shows you how to author one, how the scheduler dispatches it, and how to operate it after it is running.
You’ll learn:
- The Pipeline object and how
mode,schedule, andinc_columnshape a run- Full vs incremental modes, watermarks, and the
_goni_ingested_atfreshness marker- Run now, rerun, cancel, rebuild-target, trash + restore + purge
- Notifications and the schedule preview endpoint
The Pipeline object
A pipeline is a YAML document managed through PUT /api/pipelines/{id}. It is owned by exactly one tenant and is not visible outside its tenant boundary.
# managed by PUT /api/pipelines/{id}
- id: acme-orders
name: "Acme orders"
connection_id: acme-postgres
source: public.orders # source-side table
target_table: acme.orders # ClickHouse fully-qualified target
mode: incremental # full | incremental
inc_column: updated_at
inc_start_value: "'2026-01-01'" # inner single quotes wrap the SQL literal
schedule: "*/15 * * * *" # cron, or "15m" / "1h" / "off"
enabled: true
add_audit_columns: true # stamp _goni_ingested_at on every row
schema_change_policy: propagate_all
notifications:
- type: slack
url: https://hooks.slack.com/services/...
on: [failed]
Schedule grammar and the preview endpoint
schedule accepts five shapes:
| Shape | Example | Meaning |
|---|---|---|
| Off | off, 0, empty | Disabled, never fires |
| Interval | 15m, 1h, 6h, 1d | Every N units |
| Cron (5-field) | 30 2 * * * | Airflow-style, UTC by default |
Cron @-descriptor | @daily, @hourly, @every 15m | Standard crontab macros |
| Cron with timezone | CRON_TZ=Europe/Berlin 0 9 * * MON-FRI | Standard IANA zone name |
Quartz L / L-N | 0 23 L * * | Last day of month at 23:00 |
@reboot is explicitly rejected. Quartz W and # are not implemented.
Before saving, hit the preview endpoint to see what the schedule actually resolves to:
curl "$GONI_API/api/schedule/preview?schedule=CRON_TZ=Europe/Berlin+0+9+*+*+MON-FRI&count=5"
The response returns the parsed kind plus the next count fire times in UTC. count is capped at 20. This is what the SchedulePicker in the pipeline editor calls on every keystroke, so a bad regex surfaces as an inline parse error rather than a silent midnight run.
Modes and watermarks
mode: full truncates target and reinserts every source row on each dispatch.
mode: incremental appends only rows whose inc_column is greater than SELECT max(inc_column) FROM target_table. On the very first run, when the target is empty, inc_start_value supplies the seed literal so you do not accidentally full-load a decade of history. After the first successful run the warehouse-side max() takes over and inc_start_value is ignored. inc_column names must match ^[A-Za-z_][A-Za-z0-9_]*$; anything else is refused at save time to keep hand-edited YAML from smuggling SQL into the WHERE clause.
add_audit_columns: true adds a trailing _goni_ingested_at DateTime64(3, 'UTC') DEFAULT now64(3) column to the target. ClickHouse fills it on every INSERT batch, so every warehouse row carries a server-side “when did this land” stamp. The freshness runner and data quality tests both key off this column when the source has no reliable updated_at.
For late-arriving updates and hard deletes, add incremental_window. The target is created as a ReplacingMergeTree with _goni_version and _goni_del_flag, and each run re-reads the last window_value days of inc_column. Consumers query the auto-created <target>__goni_current view rather than the raw table so they never write FINAL.
mode: incremental
inc_column: updated_at
incremental_window:
window_value: 3
window_unit: days
delete_strategy: antijoin # source_flag | antijoin | none
Operating a pipeline
Every endpoint below lives under /api/pipelines/{id}. Each write path is tenant-scoped and requires allow_pipelines for the id plus the coarse allow_save / allow_delete scopes as appropriate.
| Method | Path | Purpose |
|---|---|---|
POST | /api/pipelines/{id}/run | Dispatch immediately, out of schedule |
POST | /api/pipelines/{id}/runs/{run_id}/rerun | Re-dispatch a specific run using current config + live watermark |
POST | /api/pipelines/{id}/runs/{run_id}/cancel | Cancel an in-flight run; finishRun stamps a terminal error row |
POST | /api/pipelines/{id}/rebuild-target | Atomically recreate the target in safe-window shape via EXCHANGE TABLES |
GET | /api/pipelines/{id}/runs | Paginated run history |
GET | /api/pipelines/{id}/runs/{run_id}/log | Stream the per-run structured log |
GET | /api/pipelines/health | Aggregate health for the ops dashboard |
rebuild-target is postgres-only and refuses if incremental_window is not set (there is nothing to rebuild on a plain MergeTree). If a run is already in flight it returns 409 with PIPELINE_INFLIGHT so the caller can retry.
Trash, restore, purge
DELETE /api/pipelines/{id} is a soft-delete: it stamps deleted_at and deleted_by, hides the pipeline from every user-facing list, and takes it out of the scheduler sweep. The Pipelines UI keeps this recoverable.
GET /api/pipelines/trashlists soft-deleted rows for the current tenant, newest firstPOST /api/pipelines/{id}/restoreclears the tombstone and the pipeline reappearsDELETE /api/pipelines/{id}/purgehard-removes a soft-deleted row and refuses on a live row
The Pipelines detail view renders a downstream panel alongside the delete button so you see which dashboards, charts, and semantic models depend on this target before you confirm.
Notifications
Attach fan-out destinations directly on the pipeline. After the terminal run row lands, Goni fans out to Slack, a generic HMAC-signed webhook, or an email stub - without anyone opening the UI.
notifications:
- type: slack
url: https://hooks.slack.com/services/T00/B00/xxxx
on: [failed, schema_change]
- type: webhook
url: https://ops.example.com/goni/pipelines
secret: whsec_... # HMAC-SHA256 -> X-Goni-Signature: sha256=<hex>
on: [failed]
Every outbound URL passes through the same SSRF guard used by alert channels, so private-IP and cloud metadata targets are refused. Delivery is rate-limited per (pipeline_id, status) pair per Goni instance to one page per minute, so a crashlooping pipeline cannot page the on-call rotation 300 times an hour.
For workspace-wide “run this SQL and alert if the number changes” rules, use alerts and scheduled reports instead. Per-pipeline notifications are for the delivery event; alerts are for the metric.
Related
Last updated