Skip to main content

Execute Query

Executes a PostgreSQL query SQL statement (SELECT) and returns the results.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - The unique identifier of the database connection to use.
  • Transaction Id - The unique identifier of the transaction (optional).
  • SQL Query - The SQL SELECT statement to execute (can include template variables).

Options

  • None

Output

  • Result - The query results returned as a table structure.

How It Works

The Execute Query node executes a PostgreSQL SELECT SQL statement and returns the results. When executed, the node:

  1. Validates the provided connection ID and retrieves the connection
  2. Optionally retrieves the transaction if a transaction ID is provided
  3. Processes template variables in the SQL query using the message context
  4. Creates and executes the SQL command
  5. Reads the results into a DataTable
  6. Converts the DataTable to a table structure
  7. Returns the table structure as output

Requirements

  • A valid PostgreSQL connection must be established
  • The SQL query must be a valid SELECT statement
  • If using transactions, a valid transaction ID must be provided

Error Handling

The node will return specific errors in the following cases:

  • Connection Id not found in the connections dictionary
  • Transaction Id not found in the transactions dictionary

Usage Notes

  • The SQL Query input supports template variables using double curly braces (e.g., {{variableName}})
  • Template variables are populated from the message context
  • Query results are returned as a table structure that can be used in subsequent nodes
  • When using transactions, the transaction must be committed using the Commit Transaction node
  • The SQL editor provides syntax highlighting for SQL statements