Export Query
Exports the results of a SQL query to a file.
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).
- Export Path - The file path where the query results will be exported.
- SQL Export - The SQL query to execute (supports template variables).
Options
- Seperator - The character used to separate values in the exported file. Options are:
- semicolon (;)
- comma (,)
- tab (\t)
- space ( )
How It Works
The Export Query node executes a SQL query and exports the results to a file. When executed, the node:
- Validates the provided Connection Id and Export Path inputs
- Looks up the database connection in the SQLite connection pool
- If provided, looks up the transaction in the SQLite transaction store
- Deserializes message data for use in SQL template variables
- Renders the SQL query using template variables with Stubble template engine
- HTML decodes the rendered SQL query
- Creates and executes a SQLite command with the rendered query
- Reads the query results using a data reader
- Writes the column headers and data rows to the specified export file
- Uses the selected separator character between values
Requirements
- A valid database connection identifier from the Connect node
- Valid file path with write permissions for the export file
- Valid SQL query that returns data
- Sufficient disk space for the exported file
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Connection Id
- Connection with the specified Id not found
- Empty or invalid Export Path
- Invalid SQL query
- Database connection issues
- Insufficient permissions to write to the export file
- Transaction with the specified Id not found (if Transaction Id is provided)
Usage Notes
- The SQL Export field supports template variables using double curly braces (e.g.,
{{variableName}}
) - Template variables are populated from the message data
- The exported file will include column headers as the first row
- If a Transaction Id is provided, the query will be executed within that transaction
- The separator option determines how values are separated in the exported file
- The exported file format is CSV-like but with configurable separators
- Ensure the directory in the export path exists before running the node