Skip to main content

Database Row Trigger

The Database Row Trigger polls a database table on an interval and starts one run for each new row it finds. Use it to react to new orders, sign-ups or events in a database you own, without changing that application.

Polling starts when you publish the workflow. Changes to the trigger take effect on the next publish.

Settings​

NameRequiredDefaultDescription
Database TypeYes—The database engine. Currently PostgreSQL.
PostgreSQL connectionYes*—A PostgreSQL Database connection. See Connection.
Connection String (secret, legacy)Yes*—A project secret that holds a connection string. Only used when no connection is selected.
TableYes—The table to poll. Schema-qualified names work, for example public.orders.
Cursor ColumnYes—The column that orders rows, usually a creation timestamp or an increasing id, for example created_at.
Key Column (unique, tie-breaker)NoidA unique column used to order rows that share a cursor value, and to recognise rows already seen.
FiltersNo—Structured conditions as JSON. See Filtering rows.
WHERE Filter (advanced)No—A simple SQL condition, used only when Filters is empty.
Max rows per pollNo100How many new rows one poll picks up (1–1000). The rest are picked up by the next polls.
Poll Interval (seconds)No60How often to poll. Raised to your plan's minimum if lower. See Poll interval.

* Select a PostgreSQL connection or, in existing workflows, a Connection String secret.

Connection​

Pick a connection in PostgreSQL connection. The picker only lists PostgreSQL connections, and New PostgreSQL connection creates one without leaving the editor. Host, port, database, user, password and SSL mode come from the connection. Its sign-in details resolve in the trigger's environment, so each environment can point at its own database. See Database, SFTP, IMAP and SMTP connections.

The trigger supports PostgreSQL only. If the step points at another kind of connection, or at a MySQL or SQL Server connection (for example in imported workflow JSON), publishing reports an error such as "'Orders DB' is not supported here: PostgreSQL connection accepts PostgreSQL connections only." To read MySQL or SQL Server, use the Database Query step.

In the workflow JSON the connection is stored as connectionId. Steps saved with the older connection key still work.

Connection string (legacy)​

Workflows created before Database connections keep working unchanged. When no connection is selected, the trigger reads a connection string from the secret in Connection String (secret, legacy), resolved in the trigger's environment:

Host=db.example.com;Port=5432;Database=shop;Username=blokkio_reader;Password=…;SSL Mode=Require

For new workflows, use a connection instead.

Database user​

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

The database host must be reachable from the internet. Hosts that resolve to private or internal addresses are blocked.

Names​

Table, cursor and key names may only contain letters, digits and underscores, plus one dot for a schema (public.orders). They are quoted before use, so they are case sensitive: createdAt and createdat are different columns.

How polling works​

Rows are read in a stable order, cursor column first and key column second. After each poll, Blokkio stores the cursor and key of the last row it read and the next poll continues strictly after it:

SELECT *
FROM "public"."orders"
WHERE "created_at" IS NOT NULL
AND ("created_at" > @cursor OR ("created_at" = @cursor AND "id" > @key))
AND (<your filters>)
ORDER BY "created_at" ASC, "id" ASC
LIMIT 100

This "keyset" cursor means rows that share the same cursor value are never skipped, even when they straddle the Max rows per poll boundary.

  • First poll. The trigger fires for rows created since you published it; rows that existed before don't start runs. When the cursor column holds date-times, the first successful poll also picks up rows created since publishing that earlier, failed polls missed (for example while the database was unreachable), up to the last 24 hours and the newest 50 rows. With a numeric cursor column (an id), the first successful poll starts after the current last row.
  • NULL cursor values. Rows whose cursor column is NULL are never picked up.
  • Republishing. Publishing again without changing the trigger keeps the stored cursor, so nothing is replayed or skipped. If you change the trigger's settings (another table, cursor column, filters or connection), or turn the workflow off and on, it starts again from the new publish time.
  • Choose good columns. The cursor column should only ever grow for new rows (an insert timestamp or an identity column) and should be indexed, ideally together with the key column.

Duplicates​

Every row is identified by its table and key column value. Blokkio remembers which rows it has already started a run for (for 30 days) and never starts a second run for the same row, even if a poll is repeated after a crash. This also means that updating a row, for example changing updated_at, does not trigger it again.

Filtering rows​

Use Filters to only react to some rows. It takes a JSON array of conditions, combined with AND:

[
{ "column": "status", "operator": "eq", "value": "paid" },
{ "column": "amount", "operator": "gte", "value": "100" },
{ "column": "email", "operator": "endsWith", "value": "@example.com" }
]
OperatorMeaning
eq, neqEqual, not equal
gt, gte, lt, lteGreater / less than (or equal)
contains, startsWith, endsWithCase-insensitive text match
isNull, isNotNullColumn is / isn't NULL (no value needed)

Values are always sent as query parameters and converted to the column's type by PostgreSQL, so "100" compares correctly with a numeric column.

WHERE Filter (advanced)​

If you prefer SQL, leave Filters empty and write a condition in WHERE Filter:

status = 'paid' AND (amount > 100 OR country IN ('DE', 'AT')) AND deleted_at IS NULL

Only a single boolean condition is allowed: column names, string and number literals, comparison operators, AND, OR, NOT, IS [NOT] NULL, [NOT] IN, LIKE, ILIKE, BETWEEN and parentheses. Literals are turned into parameters. Function calls, sub-queries, casts, comments and keywords such as SELECT, UNION or LIMIT are rejected.

Poll interval​

Poll Interval (seconds) defaults to 60. Your plan sets the minimum, from 5 minutes on the smallest plan down to 15 seconds on the largest (see Plans and limits).

If you enter a lower value, the editor shows a warning and the trigger polls at your plan's minimum instead. See Plan limits.

Trigger output​

Each new row starts its own run. The trigger outputs the row as an object, one field per column:

{
"id": 1042,
"customer_email": "ana@example.com",
"status": "paid",
"amount": 149.9,
"created_at": "2026-11-11T09:30:12.123456Z"
}

Use the columns in later steps with $trigger or the trigger step's name:

{{ $trigger.customer_email }}
{{ $nodes['Database Row Trigger'].amount }}

Testing​

Click Test run in the editor header and pick the Database Row Trigger to start a run from the last saved draft. A test run doesn't query the database. To test the rest of the workflow without inserting rows, paste a sample row in the dialog's Trigger data box (a JSON object, same shape as the trigger output); it becomes $trigger and the trigger step's output, so {{ $trigger.customer_email }} and $nodes['Database Row Trigger'].customer_email work as in a real run. To reuse the same row in every test run, you can instead pin it on the trigger's output; pinned data is only used in test runs.