Skip to main content

Update

Modifies an existing item. Pass the full key as keyword arguments, then use the 5 update actions.

Update Actions

ActionDescriptionDynamoDB clause
setSet attribute valuesSET #attr = :val
removeRemove attributesREMOVE #attr
appendAppend to a listSET #attr = list_append(#attr, :val)
addIncrement number or add to setADD #attr :val
deleteRemove elements from a setDELETE #attr :val

Basic Usage

orders.update(
user_id="usr_123", order_id="ord_789",
set={"status": "SHIPPED", "shipped_at": "2025-02-24"},
remove=["temp_notes"],
append={"history": {"action": "shipped", "at": "2025-02-24"}},
add={"version": 1, "tags": {"urgent"}},
delete={"old_tags": {"deprecated"}},
)

Nested Paths

Nested paths work in set:

orders.update(
user_id="usr_123", order_id="ord_456",
set={"address.city": "Lima", "items[0].qty": 5},
)

Multiple actions can be combined in a single update() call.