TiDB Cloud icon

TiDB Cloud

Use TiDB Cloud

Overview

The TiDB Cloud node for n8n allows you to interact with a TiDB Cloud database. Specifically, the Default → Update operation updates rows in a specified table within your TiDB Cloud database. This is useful when you need to modify existing records based on a unique key (such as an ID) and update one or more columns with new values.

Common scenarios:

  • Synchronizing data from another system by updating existing records.
  • Correcting or enriching information in your database.
  • Bulk-updating multiple rows based on input data.

Example use case:
You have a list of user records with updated email addresses. You can use this node to update the email column for each user where the id matches.


Properties

Name Type Meaning
Project Resource Locator The TiDB Cloud project to operate on.
Cluster Resource Locator The specific cluster within the project where the database resides.
User Resource Locator The database user to authenticate as.
Database String The name of the database containing the target table.
Password String (Password) The password for the database user.
Table Resource Locator The table in which to update data.
Update Key String The column used to identify which rows should be updated (e.g., "id").
Columns String Comma-separated list of columns to update (e.g., "name,email").

Output

The output is a JSON array where each item corresponds to the result of an update operation for an input item. Each output object contains the result returned by the underlying database driver for the executed UPDATE statement. Typical fields may include:

  • Information about affected rows (e.g., number of rows updated).
  • Status of the update operation.

Example output:

[
  {
    "affectedRows": 1,
    "changedRows": 1,
    "fieldCount": 0,
    "insertId": 0,
    "serverStatus": 2,
    "warningCount": 0,
    "message": "(Rows matched: 1  Changed: 1  Warnings: 0)"
  }
]

If an error occurs and "Continue On Fail" is enabled, the output will contain an error field with the error message.


Dependencies

  • External Service: Requires access to a TiDB Cloud instance.
  • Credentials: Needs a configured tiDBCloudApi credential in n8n, including API keys or connection details.
  • n8n Configuration: Ensure network access to TiDB Cloud and that credentials are set up in n8n.

Troubleshooting

Common issues:

  • Authentication errors: Incorrect credentials or lack of access to the specified project/cluster/user.
  • Table or column not found: Specified table or columns do not exist in the database.
  • Update Key mismatch: If the value for the update key does not match any row, no rows will be updated.
  • SQL errors: Malformed column lists or invalid data types.

Error messages:

  • "ER_BAD_FIELD_ERROR": A specified column does not exist. Check the "Columns" and "Update Key" values.
  • "Access denied": Credentials are incorrect or insufficient permissions.
  • "The operation \"update\" is not supported!": Should not occur unless the node is misconfigured.

How to resolve:

  • Double-check all property values, especially table and column names.
  • Ensure the user has sufficient privileges.
  • Verify the database connection and credentials.

Links and References

Discussion