Skip to main content

Database Row Trigger

The Database Row Trigger polls a database table on a recurring interval and fires the workflow once for each new row it detects. Rows are identified as "new" by comparing a cursor column — typically an auto-increment ID or a timestamp — against the last value seen in the previous poll.

Properties

PropertyRequiredDescription
Database TypeYesThe engine of the target database. Currently PostgreSQL
Connection StringYesA Secret that holds the full database connection string
TableYesThe table to poll. Supports schema-qualified names (e.g. public.orders)
Cursor ColumnYesThe column used to detect new rows (e.g. id, created_at)
WHERE FilterNoAn optional SQL expression appended to the query's WHERE clause (e.g. status = 'active')
Poll Interval (seconds)NoHow often to poll in seconds. Defaults to 60

How polling works

Each time the trigger is due, the system runs:

SELECT *
FROM "schema"."table"
WHERE "cursor_column" > <last_cursor>
[AND (<your filter>)]
ORDER BY "cursor_column" ASC
LIMIT 100

Up to 100 rows are returned per poll. If more rows exist, they are picked up in subsequent polls as the cursor advances.

Cursor initialisation

On the first poll after a workflow is published, the trigger records the current maximum value of the cursor column and returns no rows. This means only rows inserted after publishing will trigger the workflow — historical data is not backfilled.

Cursor tracking

After each successful poll the cursor advances to the highest cursor column value seen in that batch. The cursor is persisted between polls, so restarts or redeployments do not cause duplicate executions.

Cursor column types

The trigger automatically adapts the comparison to the column type:

Detected typeExample values
Integer / bigint1, 42, 100023
Timestamp with time zone2026-01-15T09:30:00Z
TextAny other string value

Choose an indexed, monotonically increasing column for best performance.

Connection string

The connection string must be stored as a Secret before configuring the trigger. In the Connection String field, select the secret by name.

PostgreSQL example connection string:

Host=my-db.example.com;Port=5432;Database=mydb;Username=reader;Password=secret

Use a dedicated read-only database user. The trigger only executes SELECT queries.

Table and column naming

Table and cursor column names must contain only letters, digits, and underscores (a-z, A-Z, 0-9, _). Schema-qualified names are supported using a single dot (public.orders). Names are double-quoted before execution to preserve case and prevent SQL injection.

The optional WHERE Filter is passed through verbatim — ensure it contains only safe, validated expressions.

Registration

The polling schedule is registered when the workflow is published. Changes to any trigger property take effect on the next publish. Archiving or deleting a workflow removes the registration and its cursor state.

Trigger output

Each matched row is passed to downstream nodes individually. Access the row's columns in expressions using $TriggerData:

{{ $TriggerData.order_id }}
{{ $TriggerData.status }}
{{ $TriggerData.created_at }}

Every column returned by the SELECT * query is available as a field on $TriggerData.