SQL Databases
The SQL Databases node executes SQL queries against relational databases. It supports MySQL, PostgreSQL, and Microsoft SQL Server (MSSQL). You can run SELECT queries to retrieve data, or execute INSERT, UPDATE, DELETE, and DDL statements for data manipulation.
The database type is determined by the connection configuration, not by the action name. All three database types use the same sql:mysql action.
Before You Use This Node
| What you may need | Where to set it up | Why it matters |
|---|---|---|
| SQL database connection | Connections | Save database host, username, password, and database details once, then reuse them. |
| Common dates, IDs, or environment names | Global Variables | Use shared values inside queries without editing every workflow. |
| Reusable reference data | Datasets | Keep lookup data available for database-related workflows. |
Actions
| Action | Description |
|---|---|
sql:mysql | Execute a SQL query against a MySQL or PostgreSQL database |
Despite the action name sql:mysql, this action works with MySQL, PostgreSQL, and MSSQL. The database type is determined by the connection configuration.
sql:mysql
Executes a SQL statement and returns the result set (for SELECT) or the affected row count (for DML/DDL).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
connectionId | string | Yes | ID of the SQL database connection |
query | string | Yes | The SQL query to execute. Supports variable interpolation with \{\{variable\}\} syntax |
Example: SELECT Query
Example: INSERT Statement
Example: UPDATE Statement
Example: Parameterized with Workflow Variables
Connection
Requires a SQL Database connection configured in the Global Configurator. The connection specifies:
| Field | Description |
|---|---|
host | Database server hostname or IP address |
port | Database port (MySQL default: 3306, PostgreSQL default: 5432) |
database | Database name |
username | Database user |
password | Database password |
databaseType | mysql, postgresql, or mssql |
sslEnabled | Whether to use SSL for the connection |
Configure under Connections > SQL Database in the Global Configurator.
Query Safety
Use expression references to pass dynamic values into queries instead of building query strings through concatenation. This helps prevent SQL injection when query values come from external input such as API responses or user-submitted data.
For example, reference a previous step's output in a WHERE clause rather than concatenating raw strings into the query. This ensures values are handled safely by the database driver.
Transaction Behavior
- Each query executes as a single auto-committed transaction.
- For multi-statement operations, each statement runs independently. A failure in one statement does not roll back previous statements.
- If you need atomic multi-step operations, group them in a single query using
BEGIN/COMMITblocks, or use stored procedures. - INSERT, UPDATE, and DELETE statements are auto-committed upon successful execution.
Common Problems
| Symptom | Likely Cause | Fix |
|---|---|---|
| Connection timeout | Incorrect host or port, or firewall blocking access | Verify host and port in the connection config. Check network and firewall rules |
| Access denied | Wrong credentials or insufficient privileges | Confirm username, password, and database name. Ensure the user has the required grants |
| Table not found | Incorrect schema or database name, or case sensitivity issue | Check the database field and table name spelling. Some databases are case-sensitive |
| Query timeout | Slow query or large dataset | Optimize the query, add indexes, or reduce the data volume with WHERE clauses and LIMIT |
| Too many connections | Connection pool exhaustion | Review connection pool settings in the connection configuration. Avoid running many parallel workflows against the same database |
Output
SELECT Queries
Returns the result set as an array of row objects:
DML Statements (INSERT, UPDATE, DELETE)
Returns the count of affected rows: