upsert_table_rows
Add rows, or update the ones that already exist — the repeatable write.
Use this instead of add_table_rows whenever the same logical row could be written more than once: anything on a schedule, anything retried, anything keyed by a period. add_table_rows always appends, so a second run of the same job duplicates its rows and every later reader counts them twice.
A row matches an existing one when EVERY dedup_keys column holds the same value; matched rows are updated in place, unmatched rows are created.
Args: table_id: The table id (e.g. “dtbl_abc123”) rows: JSON array of {column_key: value} objects dedup_keys: JSON array of column keys identifying a row, e.g. [“channel”, “month”]. Every key must have a value in every row.
Returns: {table_id, created, updated, row_ids}
Errors rather than guessing when a dedup key is unknown, a row is missing one, two rows in the batch share a key, or more than one existing row already matches.
Parameters#
| Name | Type | Required | Default |
|---|---|---|---|
table_id | string | yes | |
rows | any | yes | |
dedup_keys | any | yes |
Generated from the server tool’s docstring by generate_mcp_docs. Extend this page freely — the generator never overwrites an existing file.