Schedule icon
Query icon
If icon
Assert icon
SlackIncomingWebhook icon
Log icon

Maintain a Postgres customer dimension with SCD Type 2 history

Load a customer feed into a Postgres SCD Type 2 dimension, quarantine invalid rows, and alert Slack only when a version opens or closes.

Categories
Data

Close the current customer row when name, email, city, or plan changes, insert a new current version, and quarantine rows with a missing email or city. A unique index plus an assertion keep exactly one is_current row per customer. Slack fires only when this run opened, closed, or quarantined a row; the same snapshot is a no-op. Overlapping merges are blocked with concurrency.limit: 1.

Prerequisites: Postgres (the flow creates stg_customer, dim_customer, and quarantine_customer) and a Slack incoming webhook.

Secrets:

  • POSTGRES_URL: JDBC URL (for example jdbc:postgresql://postgres:5432/warehouse)
  • POSTGRES_USER / POSTGRES_PASSWORD: role that can create tables
  • SLACK_WEBHOOK: incoming webhook URL

Input snapshot: baseline (default) or address_change.

Quick start: set secrets, run baseline (3 opened), run it again (no Slack), then address_change (2 opened, 1 closed, 1 quarantined). Counts are {{ outputs.audit_dimension.row.opened_versions }}, .closed_versions, .quarantined, and .broken_keys.

Links: PostgreSQL, If, Slack. Created by parshipcy.

See How

New to Kestra?

Use blueprints to kickstart your first workflows.