ClickHouse icon

ClickHouse

Query, insert, update, delete, and manage ClickHouse tables. Supports AI agent tool use with schema discovery, auto-pagination for large results, and parameterized queries.

Update Rows

AI-generated

Summary

Update rows in a ClickHouse table that match a WHERE condition, setting specified column values.

Inputs

  • table (required) — The table to update rows in. Choose from the list, or specify an ID using an expression.
  • columns (required) — Column-value pairs to set in the matching rows.
  • where (required) — The WHERE condition for the UPDATE. Rows matching this condition will be updated. Do NOT include the WHERE keyword.
  • database — Override the database from credentials. Choose from the list, or specify an ID using an expression.
  • options — Options such as query settings; includes Database Name or ID and Query Settings.

Output shape

An object indicating success and details of the update operation; typically contains success, operation, table, columnsUpdated, where, and response fields.

If the operation succeeds, the returned JSON includes success:true and the update details; on failure with continueOnFail enabled, an error field is returned instead of success.

Examples

Example 1: Set the `status` column of row with `id = 42` to `'active'` in the `users` table.

Table Name: users; Columns to Update: [{Column Name: status, Value: 'active'}]; Where Clause: id = 42

Example 2: Update multiple columns (`status` and `last_login`) for rows where `group = 'beta'`.

Table Name: users; Columns to Update: [{Column Name: status, Value: 'inactive'}, {Column Name: last_login, Value: '2024-01-01'}]; Where Clause: group = 'beta'

Example 3: Override database to `analytics` while updating `metrics` table.

Table Name: metrics; Where Clause: metric_id = 123; Options: {"database": "analytics", "querySettings": {"mutations_sync": 1}}

Links

Discussion