Heliont MySQL

Execute parameterized queries on MySQL and merge results into input JSON.

Overview

This node executes parameterized SQL queries on a MySQL database and merges the query results into the input JSON data. It is useful when you want to enrich or filter your workflow data by fetching related information from a MySQL database dynamically.

Common scenarios include:

  • Retrieving user details based on user IDs present in the input data.
  • Running custom SELECT queries with parameters to fetch specific records.
  • Combining external database data with existing workflow items for further processing.

For example, if your workflow processes orders and you want to add customer information from a MySQL database, you can use this node to run a query like SELECT * FROM customers WHERE id = ? with the order's customer ID as a parameter.

Properties

Name Meaning
Query The SQL query to execute. Use ? placeholders for parameters to safely insert values.
Parameters Array of parameters to bind into the query, each corresponding to a ? placeholder in the query.

Output

The node outputs an array of items where each item contains the original input JSON merged with a new field named result. This result field holds the array of rows returned by the executed SQL query for that particular input item.

Example output structure per item:

{
  "json": {
    "...originalInputFields": "...",
    "result": [
      { "column1": "value1", "column2": "value2" },
      { "column1": "value3", "column2": "value4" }
    ]
  }
}

No binary data is produced by this node.

Dependencies

  • Requires a MySQL database accessible via network.
  • Needs credentials containing host, port, database name, username, and password to connect to the MySQL server.
  • Uses the mysql2/promise Node.js package internally for database communication.
  • The node expects proper configuration of these credentials within n8n.

Troubleshooting

  • Connection errors: If the node cannot connect to the database, verify the host, port, database name, username, and password are correct and that the database server is reachable.
  • Query syntax errors: Invalid SQL syntax will cause errors. Test your query independently before using it in the node.
  • Parameter mismatch: Ensure the number of parameters matches the number of ? placeholders in the query; otherwise, the query execution will fail.
  • Empty results: If no rows match the query, the result array will be empty but the node will still succeed.
  • Credential issues: Missing or incorrect credentials will prevent connection. Make sure the API key or authentication token is properly set up in n8n.

Links and References

Discussion