Skip to main content

Execute Query

Executes a SQL query command (SELECT) on a SQLite database 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 identifier of the database connection to use.
  • Transaction Id - The identifier of the transaction to use (optional).
  • SQL Query - The SQL query command to execute (supports template variables).

Output

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

How It Works

The Execute Query node runs a SQL SELECT command and returns the results. When executed, the node:

  1. Validates the provided Connection Id input
  2. Looks up the database connection in the SQLite connection pool
  3. If provided, looks up the transaction in the SQLite transaction store
  4. Deserializes message data for use in SQL template variables
  5. Renders the SQL query using template variables with Stubble template engine
  6. HTML decodes the rendered SQL query
  7. Creates and executes a SQLite command with the rendered query
  8. Reads the query results using a data reader
  9. Loads the results into a DataTable
  10. Converts the DataTable to a Table object
  11. Returns the Table object as output

Requirements

  • A valid database connection identifier from the Connect node
  • Valid SQL SELECT query command
  • Sufficient database permissions for the requested operation

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Connection Id
  • Connection with the specified Id not found
  • Invalid SQL query
  • Database connection issues
  • Transaction with the specified Id not found (if Transaction Id is provided)
  • Insufficient permissions for the database operation

Usage Notes

  • The SQL Query field supports template variables using double curly braces (e.g., {{variableName}})
  • Template variables are populated from the message data
  • The Result output contains the query results as a table structure
  • If a Transaction Id is provided, the query will be executed within that transaction
  • This node is specifically for query commands that return data (SELECT)
  • For INSERT, UPDATE, DELETE commands, use the Execute Non Query node instead
  • Large result sets may impact performance, consider using LIMIT clauses for large tables