Overview
This node executes SQL queries against a Trino database. It is designed to connect to a Trino server using provided credentials and run arbitrary SQL commands, returning the results as JSON data. This node is useful for integrating Trino-based data analytics or querying capabilities into automated workflows, enabling users to fetch, filter, and manipulate large datasets stored in Trino.
Common scenarios include:
- Retrieving metadata about tables or schemas.
- Running analytical queries on large distributed datasets.
- Automating data extraction from Trino for further processing or reporting.
Example: A user might query the jmx.information_schema.tables to get a list of tables available in the Trino instance, or execute complex aggregation queries to generate reports.
Properties
| Name | Meaning |
|---|---|
| Query | The SQL query string to execute against the Trino database. Supports multiline input. |
| Timeout (Seconds) | Maximum time in seconds to wait before aborting the query and closing the connection. |
Output
The node outputs an array of items where each item contains a json property representing one row of the query result. Each row is an object with keys corresponding to column names and values corresponding to the respective cell data.
If the query returns multiple rows, each row is output as a separate item in the array.
No binary data output is produced by this node.
Dependencies
- Requires a Trino server accessible via network.
- Needs credentials including host, port, user, password, catalog, and schema to connect.
- Uses an API key credential or username/password authentication for Trino.
- Optional SSL configuration and custom HTTP headers can be set in credentials.
- The node depends on the external
trino-clientlibrary for communication with the Trino server.
Troubleshooting
- Port missing in credentials: The node throws an error if the port is not specified in the credentials. Ensure the Trino port is configured.
- Timeout errors: If the query takes longer than the specified timeout, the operation is aborted with a timeout error. Increase the timeout or optimize the query.
- Invalid HTTP headers: If HTTP headers are provided as a string but cannot be parsed as valid JSON, they will be ignored with a warning.
- Query errors: If the Trino server returns an error for the query, the node throws an error with the message from Trino.
- SSL issues: If SSL is enabled but certificates are invalid or ignored incorrectly, connection may fail. Adjust SSL settings accordingly.
- Connection failures: Network issues, incorrect host, or authentication failures will cause errors during connection initialization.
Links and References
- Trino Official Documentation
- Trino Client Library (npm)
- SQL Tutorial (for writing queries)