MySQL node common issues#
Here are some common errors and issues with the MySQL node and steps to resolve or troubleshoot them.
Update rows by composite key#
The MySQL node's Update operation lets you to update rows in a table by providing a Column to Match On and a value. This works for tables where single column values can uniquely identify individual rows.
You can't use this pattern for tables that use composite keys, where you need multiple columns to uniquely identify a row. A example of this is MySQL's user
table in the mysql
database, where you need both the user
and host
columns to uniquely identify rows.
To update tables with composite keys, write the query manually with the Execute SQL operation instead. There, you can match on multiple values, like in this example which matches on both customer_id
and product_id
:
1 |
|
Decimal numbers returned as strings#
By default, the MySQL node returns DECIMAL
values as strings. This is done intentionally to avoid loss of precision that can occur due to limitation with the way JavaScript represents numbers. You can learn more about the decision in the documentation for the MySQL library that Localmind Automate uses.
To output decimal values as numbers instead of strings and ignore the risks in loss of precision, enable the Output Decimals as Numbers option. This will output the values as numbers instead of strings.
As an alternative, you can manually convert from the string to a decimal using the toFloat()
function with toFixed()
or with the Edit Fields (Set) node after the MySQL node. Be aware that you may still need to account for a potential loss of precision.