
AS400 Trigger
CertifiedWait for query results on IBM AS/400 (iSeries) and trigger flow
AS400 Trigger
Wait for query results on IBM AS/400 (iSeries) and trigger flow
Periodically polls an AS/400 database by executing a SQL query at the specified interval (default 60 seconds). Triggers a downstream flow execution when the query returns one or more rows. Supports parameterized queries and afterSQL for marking processed rows. Use fetchType to control result handling. Based on DB2 implementation.
type: io.kestra.plugin.jdbc.as400.TriggerExamples
Wait for a SQL query to return results, and then iterate through rows.
id: jdbc_trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.Loop
values: "{{ trigger.rows }}"
tasks:
- id: return
type: io.kestra.plugin.core.debug.Return
format: "{{ fromJson(item.value) }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.as400.Trigger
interval: "PT5M"
url: jdbc:as400://127.0.0.1:50000/
username: "{{ secret('AS400_USERNAME') }}"
password: "{{ secret('AS400_PASSWORD') }}"
sql: "SELECT * FROM my_table"
fetchType: FETCH
Properties
sql *string
The SQL query to run
url *string
The JDBC URL to connect to the database
afterSQL string
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
fetchSize integerstring
10000Number of rows that should be fetched
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this ResultSet object. If the fetch size specified is zero, the JDBC driver ignores the value and is free to make its own best guess as to what the fetch size should be. Ignored if autoCommit is false.
fetchType string
FETCHSTOREFETCHFETCH_ONENONEThe way you want to fetch the data
Triggers default to FETCH, which loads all rows into memory and exposes them as {{ trigger.rows }}. A trigger fires only when the query returns at least one row; setting NONE would cause the trigger to never fire. Use FETCH_ONE to expose a single row as {{ trigger.row }}, or STORE to write the rows to internal storage and expose the file URI as {{ trigger.uri }}.
interval string
PT1MdurationInterval between polling.
The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.
parameters object
Parameters
A map of parameters to bind to the SQL queries. The keys should match the parameter placeholders in the SQL string, e.g., : parameterName.
password string
The database user's password
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
timeZoneId string
The time zone id to use for date/time manipulation. Default value is the worker's default time zone id
username string
The database user
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
bytes integer
Size of the stored result file in bytes
Only populated when fetchType is STORE
columnStats string
uriURI of the column statistics file in internal storage
Only populated when columnStats is true and fetchType is FETCH or STORE; file is stored in ION format
durationMs integer
Statement execution duration in milliseconds
Includes reading the result rows
row object
First row of fetched data
Only populated when fetchType is FETCH_ONE
rows array
List of all fetched rows
Only populated when fetchType is FETCH
rowsAffected integer
Number of rows affected by the statement
Reported by the JDBC driver for INSERT, UPDATE, DELETE and similar statements. Not set when the statement returns a result set or when the driver does not report a count
size integer
Number of rows fetched
Only populated when fetchType is FETCH or STORE
statement string
Executed SQL statement
Only populated when outputStatement is true. Values of secret() calls are replaced by *** and the text is truncated to 64 KiB
tables array
Tables read or written by the statement
Detected from the SQL text, so this is a best effort: CTEs, temporary tables and dialect specific syntax can lower the confidence or be missed.
Limited to 50 entries, see tablesTruncated
io.kestra.plugin.jdbc.SqlTableExtractor-TableReference
READWRITECREATEDROPHow the statement uses the table
One of READ, WRITE, CREATE or DROP.
MEDIUMLOWHow reliable the detection is
MEDIUM when detected from the SQL text, LOW for temporary tables and ambiguous names.
Database name
Null when the statement does not qualify the table with a database.
TABLEFILEURLKind of source
Only set on DuckDB: TABLE, FILE or URL (files read through read_parquet, read_csv, ATTACH and quoted paths).
Table name
For DuckDB file reads, the file path or URL.
Schema name
Null when the statement does not qualify the table with a schema.
tablesTruncated boolean
Whether the tables list was cut at 50 entries
uri string
uriURI of stored results in internal storage
Only populated when fetchType is STORE; file is stored in internal storage using ION format
warnings integer
Number of SQL warnings raised by the statement
Count of the SQLWarning chain reported by the driver, for example Postgres notices