
Trino Trigger
CertifiedWait for query results on Trino and trigger flow
Trino Trigger
Wait for query results on Trino and trigger flow
Periodically polls Trino 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. Connection details can be set as typed properties. WARNING: Do NOT include a semicolon at the end of your SQL query. Supports parameterized queries and afterSQL. Use fetchType to control result handling.
type: io.kestra.plugin.jdbc.trino.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: log_row
type: io.kestra.plugin.core.log.Log
message: "{{ fromJson(item.value) }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.trino.Trigger
interval: "PT5M"
url: jdbc:trino://localhost:8080/tpch
username: "{{ secret('TRINO_USERNAME') }}"
password: "{{ secret('TRINO_PASSWORD') }}"
sql: "SELECT * FROM my_table"
fetchType: FETCH
Installation
Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:
kestractl plugins get io.kestra.plugin:plugin-jdbc-trino --compatible-for $KESTRA_VERSION For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.
For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.
Properties
sql *string
The SQL query to run
url *string
The JDBC URL to connect to the database
accessToken string
The Trino access token used for JWT-based authentication
Sent as the accessToken connection property of the Trino JDBC driver, typically through {{ secret('TRINO_ACCESS_TOKEN') }} for an engine behind an OAuth2/OIDC authentication provider.
Browser-based OAuth2 (externalAuthentication) is not supported as it cannot complete on a headless worker.
afterSQL string
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
catalog string
The default catalog the connection runs against
Alternative to including the catalog in the JDBC URL path (jdbc: trino://host: port/<catalog>).
clientTags array
The tags attached to the queries run by this task
Lets Trino administrators route Kestra queries in resource groups managed by resourceGroupManager. Passed to the driver as the clientTags connection property (comma-separated tag names).
extraCredentials object
Extra authentication or connector-specific credentials sent as extraCredentials
Name: value pairs forwarded to the coordinator as authentication extra credentials (e.g. Kerberos delegation tokens, cloud object store keys for catalog authentication). The driver serializes them as name: value pairs joined with ;.
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.
kerberosConfig string
The Kerberos configuration (krb5.conf) file content
Written to the task working directory and passed to the driver as KerberosConfigPath.
kerberosKeytab string
The keytab file content holding the user Kerberos keys
Written to the task working directory and passed to the driver as KerberosKeytabPath, so the keytab does not have to be pre-mounted on the worker.
kerberosPrincipal string
The Kerberos principal the connection authenticates as
Passed to the driver as KerberosPrincipal.
kerberosRemoteServiceName string
The remote service (cluster coordinator) name Kerberos tickets are requested for
Passed to the driver as KerberosRemoteServiceName.
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
roles object
The catalog roles to use, as a catalog name to role mapping
Role values are a named role (e.g. admin), all or none, and the pseudo-catalog system sets the role of every catalog without an explicit entry. Passed to the driver as the roles connection property (catalog: role values joined with ;).
schema string
The default schema the connection runs against
Only used when catalog is set, either here or in the JDBC URL path.
sessionProperties object
The Trino session properties to set at connection time
Catalog-scoped properties use the catalog.property Java-style name (e.g. hive.parquet_use_column_names). Passed to the driver as the sessionProperties connection property (name: value pairs joined with ;).
source string
The client source name reported to the coordinator for every query of this task
Visible in system.runtime.queries and in the coordinator UI and usable in resourceGroupManager selectors: defaults to kestra so Kestra traffic can be identified and capacity-planned independently of other Trino clients.
ssl booleanstring
Whether to use TLS/SSL when connecting to Trino
Sets the SSL connection property of the Trino JDBC driver.
Required with a password (the driver refuses authentication with a password over plain HTTP) and when the coordinator certificate must be validated by sslTrustStore.
This is the only property the driver accepts both from the URL and here; when set it overrides the URL value.
sslKeyStore string
The client keystore content used for mutual TLS (client certificate) authentication
The keystore content (the bytes of a PKCS12 or JKS keystore base64-encoded, or a kestra:// internal storage file URI), written to the task working directory and passed to the driver as SSLKeyStorePath, so nothing has to be pre-mounted on the worker. When this is set, ssl: true is expected as well.
sslKeyStorePassword string
The password of the client keystore, when it is protected
sslKeyStoreType string
The type of the client keystore, PKCS12 (default) or JKS
Passed to the driver as SSLKeyStoreType.
sslTrustStore string
The truststore content used to validate the Trino coordinator certificate chain
The truststore content (the bytes of a PKCS12 or JKS truststore base64-encoded, or a kestra:// internal storage file URI), written to the task working directory and passed to the driver as SSLTrustStorePath.
sslTrustStorePassword string
The password of the truststore, when it is protected
sslTrustStoreType string
The type of the truststore, PKCS12 (default) or JKS
Passed to the driver as SSLTrustStoreType.
sslVerification string
FULLCANONEThe TLS/SSL certificate verification policy used by the Trino JDBC driver
FULL (driver default) validates the server certificate chain against the JVM truststore, CA validates it against the configured sslTrustStore only, and NONE skips validation (for example, a self-signed development coordinator).
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
queryId string
Engine query identifier
The id the engine coordinator assigned to the query, for example the Trino query id. Not set when the engine does not expose one.
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