MySQL Query
Description
Section titled “Description”The MySQL Query module allows executing SQL queries directly on a MySQL database. It supports dynamic variables in the query, including advanced syntax like {{@NodeName.field}}, {{#N.field}} and {{var.name}} to reference data from other workflow nodes. It is ideal for reading, inserting, updating or deleting records in MySQL as part of an automated workflow.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | MySQL connection credentials |
| query | code | Yes | SQL query to execute (supports {{variable}} variables) |
Credentials
Section titled “Credentials”The credential must contain the fields:
host: MySQL server addressuser: Database userpassword: User passworddatabase: Database nameport: Connection port (default: 3306)
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": [ { "id": 1, "nombre": "Ejemplo", "email": "test@test.com" }, { "id": 2, "nombre": "Ejemplo 2", "email": "test2@test.com" } ]}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "credentials_id": "cred_mysql_01", "query": "SELECT * FROM usuarios WHERE estado = 'activo' LIMIT 100"}With dynamic variables
Section titled “With dynamic variables”{ "credentials_id": "cred_mysql_01", "query": "SELECT * FROM pedidos WHERE cliente_id = '{{clienteId}}'"}- Supports dynamic variables
{{variable}}in the SQL query - Supports advanced syntax:
{{@NodeName.field}}to reference data from other nodes,{{#N.field}}to reference by index,{{var.name}}for memory variables - Uses the
mysql2/promiselibrary for connections - If the server’s authentication plugin is not compatible (such as
auth_gssapi_client), a descriptive error message is shown - The connection is automatically closed after each execution
- In case of SQL error, the executed query is included in the error message for easier debugging
- It is recommended not to use this query for destructive operations without prior validation
Related Nodes
Section titled “Related Nodes”- sqlQueryMSSQL (SQL Server queries)
- sqlQueryPostgres (PostgreSQL queries)
- sqlQueryPostgresSSL (PostgreSQL queries with SSL)
- sqlQueryOracle (Oracle queries)