update_rows_where
Run one UPDATE <table> SET <col> = <expr>, … WHERE <predicate>, no row-id lookup needed. DataFusion SQL, with the quoted ids run_sql takes; SET takes any expression, evaluated per row. Deleted rows never match. No WHERE updates every live row.
ONE statement, ONE table: no FROM, joins, RETURNING or second statement; SET and WHERE reference only that table. An attachment column cannot be SET. A categorical column is SET to a label (= 'Done'), make_array('Open', 'Urgent'), or NULL; never ids or another categorical column. In WHERE it is filtered by id with array_has. Cross-table: read with run_sql, then edit_rows by row id.
max_affected_rows is REQUIRED unless expect is "exactly_one". If more rows match, nothing is written and both numbers come back. At most 1000 rows per call: above that, narrow the WHERE and call again. A value that does not fit its column is refused, so integer division into a float can fail: CAST explicitly. A write landing between the read and this one is a version_conflict: call again.
For different values per row, or deletes and restores, use edit_rows.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model_id": "<model_id>",
"sql": "<sql>"
},
"name": "update_rows_where"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One `UPDATE … SET … WHERE …` statement (see the tool description). | |
| expect | No | `"any"` (default) or `"exactly_one"`. `exactly_one` refuses unless the filter matches exactly one row. | |
| dry_run | No | Count and preview up to 20 rows; write nothing. | |
| model_id | Yes | ||
| expected_version | No | Optional optimistic-concurrency guard: the table version you read at. | |
| max_affected_rows | No | Refuse if more than this many rows match. Required unless `expect` is `"exactly_one"`, which implies 1. |