Execute Query
Description
Section titled “Description”This module allows executing queries directly against different external database engines. It supports MySQL, SQL Server, MongoDB and PostgreSQL. Connection credentials are obtained from the workflow credential system via a credentials_id. For SQL databases, a query with optional parameters is sent. For MongoDB, a collection and filter are sent. It is ideal for reading or writing data to external databases as part of an automation flow.
Configuration
Section titled “Configuration”| Parameter | Type | Required | Description |
|---|---|---|---|
| dbType | string (select) | Yes | Database type. Possible values: sqlserver, mysql, mongodb, postgresql. |
| credentials_id | string | Yes | Stored credentials ID for the database connection. |
| query | string/object | Yes | SQL query or for MongoDB an object { collection, filter }. |
| params | array/object | No | Parameters for the SQL query (placeholders). |
Credentials
Section titled “Credentials”Requires credentials configured with credentials_id. The credentials must contain database connection data: host, port, username, password, database. The exact format depends on the selected database type.
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": [ { "id": 1, "nombre": "Producto A", "precio": 29.99 }, { "id": 2, "nombre": "Producto B", "precio": 49.99 } ]}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "dbType": "mysql", "credentials_id": "db_produccion", "query": "SELECT * FROM productos WHERE activo = ?", "params": [1]}- Credentials are automatically obtained from the credentials system using
credentials_id - For MongoDB, the
queryfield must be an object withcollectionandfilter - Connectors for each engine are in the
conectores/project folder - If credentials are missing or invalid, an error is returned without executing the query
- SQL queries support parameterized placeholders to prevent SQL injection
Related Nodes
Section titled “Related Nodes”- csvcreate (export results to CSV)
- schema2Excel (export results to Excel)
- dataTransform (transform query results)