Overview
This node enables executing various SQL operations on a Turso database, including deleting rows from tables. The "Delete Rows" operation specifically allows users to remove records from a specified table based on a custom WHERE clause with parameters. This is useful for data cleanup, removing outdated or unwanted entries, or enforcing business rules by deleting specific records.
Practical examples:
- Deleting user accounts that have been inactive for a long time.
- Removing test data after automated testing.
- Cleaning up log entries older than a certain date.
Properties
| Name | Meaning |
|---|---|
| Table Name | The name of the table from which rows will be deleted. |
| Where Clause | The condition to specify which rows to delete (without the "WHERE" keyword). |
| Where Parameters | Values for placeholders (?) in the WHERE clause, provided in order of appearance. |
Output
The output JSON contains a single field:
rowsAffected: Number of rows that were deleted by the operation.
Example output JSON:
{
"rowsAffected": 5
}
This indicates how many rows matched the WHERE clause and were removed.
Dependencies
- Requires a Turso database connection configured with a valid database URL and an API authentication token.
- The node uses the Turso client library to execute SQL commands.
- Proper credentials must be set up in n8n to allow access to the Turso database.
Troubleshooting
- Missing or invalid credentials: If the database URL or auth token is missing or incorrect, the node will throw a connection error. Verify your credentials configuration.
- Empty or invalid table name: The node requires a non-empty table name. Ensure the table exists in the database.
- Missing WHERE clause: For safety, the node enforces providing a WHERE clause when deleting rows. Omitting it will cause an error to prevent accidental deletion of all rows.
- Incorrect WHERE parameters count: The number of parameters must match the number of placeholders (?) in the WHERE clause. Mismatches will cause errors.
- Database errors: Any SQL errors returned by the Turso database are caught and reported with details including error code and message.
- Item index reporting: Errors include the index of the input item causing the failure, helping identify problematic inputs in batch executions.