Overview
This node, named "Speedy SQL Node," is designed to execute SQL queries against a MySQL-compatible database. It reads connection configuration from an external INI file and allows overriding these settings per input item or via node parameters. The node processes each input item individually, executes the provided SQL query, and returns the results.
Common scenarios for this node include:
- Running custom SQL queries on a MySQL database to retrieve or manipulate data.
- Integrating SQL query execution into automated workflows where dynamic queries are constructed or passed as input.
- Quickly testing or running ad-hoc SQL commands within an n8n workflow.
Example use case:
- A user wants to fetch customer records updated in the last 24 hours by passing a SELECT query dynamically to this node and then process the results downstream.
Properties
| Name | Meaning |
|---|---|
| SQL String | The SQL query string to be executed. This can be a SELECT, INSERT, UPDATE, DELETE, etc. |
Output
The node outputs an array of JSON objects under the json field. Each object corresponds to the result of executing the SQL query for one input item. The structure of each output object is:
{
"queryResult": [ /* Array of rows returned by the SQL query */ ]
}
- If the query returns rows (e.g., SELECT),
queryResultcontains an array of row objects. - For queries that do not return rows (e.g., INSERT, UPDATE), the content depends on the MySQL driver's response but will still be accessible under
queryResult. - No binary data output is produced by this node.
Dependencies
- Requires a MySQL-compatible database accessible with proper credentials.
- Reads configuration from an external INI file whose path is specified in a JSON config file (
speedy_config.json). - Uses the
mysqlNode.js package to connect and execute queries. - Requires the node to have access to the filesystem to read configuration files.
- The node expects certain connection parameters either from input items or fallback to values defined in the INI configuration file.
Troubleshooting
- Connection errors: If the node cannot connect to the database, verify that the server address, port, username, password, and database name are correct and accessible from the n8n environment.
- Query errors: Syntax errors or invalid SQL statements will cause the node to log errors. Check the SQL syntax carefully.
- Configuration issues: Ensure the external INI file and JSON config file exist at the expected paths and contain valid configuration data.
- Empty results: If no data is returned, confirm that the SQL query is correct and that the database contains matching data.
- Port defaulting: If no port is specified, the node defaults to port 3313, which may differ from the standard MySQL port (3306). Adjust accordingly if needed.
