Skip to content

Execute Query

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.

ParameterTypeRequiredDescription
dbTypestring (select)YesDatabase type. Possible values: sqlserver, mysql, mongodb, postgresql.
credentials_idstringYesStored credentials ID for the database connection.
querystring/objectYesSQL query or for MongoDB an object { collection, filter }.
paramsarray/objectNoParameters for the SQL query (placeholders).

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.

{
"nextModule": "siguiente_modulo",
"data": [
{ "id": 1, "nombre": "Producto A", "precio": 29.99 },
{ "id": 2, "nombre": "Producto B", "precio": 49.99 }
]
}
{
"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 query field must be an object with collection and filter
  • 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
  • csvcreate (export results to CSV)
  • schema2Excel (export results to Excel)
  • dataTransform (transform query results)