Overview
The TiDB Cloud node for n8n allows you to insert new rows into a specified table within a TiDB Cloud database. This is particularly useful for automating data ingestion workflows, such as syncing records from other systems, batch uploading processed data, or integrating with forms and APIs that collect information to be stored in your TiDB Cloud instance.
Practical examples:
- Automatically adding new customer records from a web form submission.
- Ingesting product data from an external API into your TiDB Cloud database.
- Migrating data from spreadsheets or other databases into TiDB Cloud.
Properties
| Name | Type | Meaning |
|---|---|---|
| Project | Resource Locator | The TiDB Cloud project where the target cluster resides. |
| Cluster | Resource Locator | The specific TiDB Cloud cluster to connect to for the operation. |
| User | Resource Locator | The database user to authenticate as when performing the insert. |
| Database | String | The name of the database within the cluster where the table exists. |
| Password | String (Password) | The password for the specified database user. |
| Table | Resource Locator | The table into which new rows will be inserted. Can be selected from a list or entered by name. |
| Columns | String | Comma-separated list of column names to insert values into (e.g., id,name,description). |
| Options | Collection | Modifiers for the INSERT statement: |
| - Ignore | Boolean: Whether to ignore ignorable errors during insertion (default: true). | |
| - Priority | Options: Set insert priority (LOW_PRIORITY or HIGH_PRIORITY). |
Output
The node outputs the result of the SQL INSERT operation as JSON. The structure typically includes metadata about the insert, such as:
[
{
"fieldCount": 0,
"affectedRows": 1,
"insertId": 123,
"info": "",
"serverStatus": 2,
"warningStatus": 0
}
]
- fieldCount: Number of fields affected.
- affectedRows: Number of rows inserted.
- insertId: The ID of the inserted row (if applicable).
- info: Additional info from the database.
- serverStatus: Status code from the server.
- warningStatus: Warning status code.
If an error occurs and "Continue On Fail" is enabled, the output will include an error message:
[
{
"error": "Error message here"
}
]
Dependencies
- External Service: Requires access to a TiDB Cloud account and an existing project/cluster.
- Credentials: You must configure the
tiDBCloudApicredential in n8n with appropriate permissions. - Environment: Ensure network access to TiDB Cloud endpoints from your n8n instance.
Troubleshooting
Common Issues:
- Authentication Errors: Incorrect credentials or insufficient permissions will prevent connection. Double-check your
User,Password, andProject/Clusterselections. - Table or Column Mismatch: If the specified table or columns do not exist, the node will throw an error. Ensure the table and columns are correct and match the database schema.
- SQL Syntax Errors: Malformed column lists or invalid options can cause SQL errors.
- Network Issues: Firewalls or connectivity problems between n8n and TiDB Cloud may block operations.
Error Messages:
"ER_BAD_FIELD_ERROR": One or more specified columns do not exist in the table."ER_NO_SUCH_TABLE": The specified table does not exist in the database."Access denied for user": Invalid user credentials or lack of privileges."The operation \"insert\" is not supported!": Should not occur unless the node is misconfigured; check operation selection.
How to resolve:
- Verify all property values, especially table and column names.
- Check user permissions in TiDB Cloud.
- Test the connection using the node's credential test feature.