Update
Update matched rows with a flat column → value map. The predicate is a SQL WHERE clause. Keyed predicates (matching the table’s merge_keys) route through the write log; non-keyed predicates update Delta directly (WAL-bypass risk). See the Data hub for the full RPC list.
| RPC | HTTP |
|---|---|
Update | POST /:bucket/tables/:table_name/update |
gRPC setup —
grpcurl, endpoints, reflection, and field-name casing — is covered once in Conventions → Using gRPC.
Update
Request
HTTP
Keyed update (predicate matches the table’s merge_keys):
curl -sS -X POST "https://k3.dev.dodil.io/kb-prod/tables/events/update" \
-H "Authorization: Bearer $DODIL_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"bucket": "kb-prod",
"tableName": "events",
"predicate": "id = 1 AND user_id = '\''u-101'\''",
"updates": {
"event_type": "click_pricing"
}
}'Non-keyed variant (⚠️ Delta-only, WAL-bypass):
curl -sS -X POST "https://k3.dev.dodil.io/kb-prod/tables/events/update" \
-H "Authorization: Bearer $DODIL_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"bucket": "kb-prod",
"tableName": "events",
"predicate": "occurred_at < TIMESTAMP '\''2025-01-01 00:00:00'\''",
"updates": { "event_type": "archived" }
}'Response
HTTP
{
"tableName": "events",
"predicate": "id = 1 AND user_id = 'u-101'",
"columnsUpdated": ["event_type"],
"version": "0",
"rowsWritten": "1",
"pendingDrain": true
}⚠️ Wire-shape gotcha —
updatesis a flat JSON object of column → literal. Do NOT wrap with"fields"— pbjson maps the object’s top-level entries directly to theStruct’s fields.{"updates": {"fields": {...}}}parses as a meaningless single-column SET clause, the request succeeds but updates nothing.
Keyed vs non-keyed routing: if predicate references the table’s merge_keys (e.g. id = 1 AND user_id = 'u-101' against merge_keys: [id, user_id]), the planner picks KEYED_UPDATE and routes through the write log. Otherwise it picks NON_KEYED_UPDATE and updates Delta directly — see Execute → Update for the WAL-bypass risk.
See also
- Execute → UPDATE — full strategy reference (
KEYED_UPDATE / KEYED_RANGE / KEYED_FROM_SUBQUERY,NON_KEYED_UPDATE+ WAL-bypass safe patterns) - Query · Insert · Merge · DeleteRows — sibling RPCs
- Maintenance → Compact — drain the write log before non-keyed updates
- Core Concepts → WriteStrategy — every routing variant
- CLI Guide —
dodil k3 table update grpcurlreference — full flag set + reflection-disabled fallbacks