Turso icon

Turso

Execute operations on Turso database

Overview

This node enables interaction with a Turso database, specifically allowing users to update rows in a specified table. It supports updating multiple rows based on a WHERE clause condition, using either incoming data items or manually entered values as the source for updated column values.

Common scenarios where this node is beneficial include:

  • Updating records in a database table dynamically based on workflow input.
  • Performing batch updates where multiple rows need modification according to specific conditions.
  • Automating database maintenance tasks such as correcting or enriching data entries.

Practical example:

  • You have a user management system and want to update the status of users who meet certain criteria (e.g., users inactive for over a year). This node can update the "status" column for all matching rows by specifying the appropriate WHERE clause and parameters.

Properties

Name Meaning
Table Name The name of the database table where rows will be updated.
Columns The columns in the table that you want to update. Multiple columns can be selected.
Data Source Specifies the source of the update data:
- Input Items: Use incoming workflow items as the data source.
- Manual Input: Enter the data values manually within the node configuration.
Values to Insert When using Manual Input as the data source, these are the values to update in the selected columns. Multiple sets of values can be provided to update multiple rows.
Item Property When using Input Items as the data source, this is the property name inside each item that contains the values for update. Leave blank if the entire item JSON contains the values directly.
Where Clause The SQL WHERE condition (without the "WHERE" keyword) used to filter which rows should be updated. This is required for safety to avoid unintentional updates to all rows.
Where Parameters The parameters corresponding to placeholders (?) in the WHERE clause, provided in order. These values are used to safely parameterize the query and prevent SQL injection.

Output

The output JSON structure for each processed item includes an array of objects representing the result of each update operation. Each object contains:

  • rowsAffected: Number of rows that were updated by the query.

Example output JSON for one update operation:

[
  {
    "rowsAffected": 3
  }
]

No binary data output is produced by this operation.

Dependencies

  • Requires a Turso database connection configured via credentials containing:

    • Database URL
    • Authentication token (API key or similar)
  • Uses the Turso client library to execute SQL queries.

  • The node expects valid SQL syntax and proper parameterization for safe execution.

Troubleshooting

  • Missing or invalid credentials: If the database URL or authentication token is missing or incorrect, the node will throw a connection error. Verify your credentials and ensure they are correctly set in n8n.

  • Empty or invalid table name: The node requires a non-empty table name. Ensure the table exists in the database and is spelled correctly.

  • No columns selected: At least one column must be selected to update. Otherwise, the node will raise an error.

  • Missing WHERE clause: For safety, the node enforces a WHERE clause on update operations. Omitting it will cause an error to prevent accidental updates to all rows.

  • Mismatch between columns and values count: When providing manual input values, the total number of values must be a multiple of the number of selected columns. Otherwise, an error is thrown.

  • Item path not found: When using input items as data source, if the specified item property path does not exist in the input data, an error will occur.

  • SQL errors: Any SQL execution errors from the database (syntax errors, constraint violations, etc.) will be reported with details including the error code and message.

Links and References

Discussion