New to Kestra?
Use blueprints to kickstart your first workflows.
Join Postgres and Iceberg in one federated Trino query with Kestra. Store the full result, compute a KPI row, and post the numbers to Slack daily.
Query two systems as if they were one. This blueprint uses Trino's federation to join a live Postgres table with an Iceberg lakehouse table in a single SQL statement, no copy jobs and no staging area. The io.kestra.plugin.jdbc.trino.Query task runs the join twice with two different fetch strategies: once with STORE to persist the full result set as a file in Kestra's internal storage, and once with FETCH_ONE to compute a single KPI row that flows straight into a Slack message.
federated_export (io.kestra.plugin.jdbc.trino.Query, fetchType: STORE) joins postgres.public.orders with iceberg.analytics.events on order_id, filtered to the last day. The full result set lands in internal storage and is exposed as {{ outputs.federated_export.uri }} for downstream tasks, while {{ outputs.federated_export.size }} carries the row count.compute_kpi (fetchType: FETCH_ONE) runs an aggregate over the same join and returns exactly one row with matched_orders, active_customers, and total_amount, addressable as {{ outputs.compute_kpi.row.* }}.notify posts the three KPI scalars and the export row count to Slack.errors block posts a distinct Slack alert when either query fails, naming the flow and execution.Schedule trigger runs the report daily at 07:00.Trino answers the query, but someone still has to run it on schedule, keep the result somewhere durable, tell the team what it said, and raise a hand when it breaks. Kestra wraps the unchanged SQL with scheduling, internal storage for the full export, output passing into notifications, retries, and a complete execution history, all declared in a few lines of YAML.
postgres catalog and an iceberg catalog configured.postgres.public.orders and iceberg.analytics.events, or adjust the SQL to your schema.TRINO_URL: JDBC URL, e.g. jdbc:trino://host:443/postgres/public (use https on 443 in production; password authentication requires TLS).TRINO_USERNAME: Trino username.TRINO_PASSWORD: Trino password.SLACK_WEBHOOK_URL: Slack incoming webhook URL.disabled: false on the daily trigger.compute_kpi and interpolate them into the Slack payload.{{ outputs.federated_export.uri }} into a downstream task to load the export into a warehouse or object storage.