Skip to main content

SQL Databases

🗄️

SQL Databases

Query and manage 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 needWhere to set it upWhy it matters
SQL database connectionConnectionsSave database host, username, password, and database details once, then reuse them.
Common dates, IDs, or environment namesGlobal VariablesUse shared values inside queries without editing every workflow.
Reusable reference dataDatasetsKeep lookup data available for database-related workflows.

Actions

ActionDescription
sql:mysqlExecute a SQL query against a MySQL or PostgreSQL database
note

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

ParameterTypeRequiredDescription
connectionIdstringYesID of the SQL database connection
querystringYesThe 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:

FieldDescription
hostDatabase server hostname or IP address
portDatabase port (MySQL default: 3306, PostgreSQL default: 5432)
databaseDatabase name
usernameDatabase user
passwordDatabase password
databaseTypemysql, postgresql, or mssql
sslEnabledWhether 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/COMMIT blocks, or use stored procedures.
  • INSERT, UPDATE, and DELETE statements are auto-committed upon successful execution.

Common Problems

SymptomLikely CauseFix
Connection timeoutIncorrect host or port, or firewall blocking accessVerify host and port in the connection config. Check network and firewall rules
Access deniedWrong credentials or insufficient privilegesConfirm username, password, and database name. Ensure the user has the required grants
Table not foundIncorrect schema or database name, or case sensitivity issueCheck the database field and table name spelling. Some databases are case-sensitive
Query timeoutSlow query or large datasetOptimize the query, add indexes, or reduce the data volume with WHERE clauses and LIMIT
Too many connectionsConnection pool exhaustionReview 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: