aito.client.requests.modify_operations.Update

class aito.client.requests.modify_operations.Update(table: str)

Bases: ModifyOperation

Update operation for the Modify API.

Uses a fluent interface:

Update("products").where({"id": "1"}).set({"name": "New Name"})

# With upsert (insert if not exists)
Update("products").where({"id": "1"}).set({"name": "Name"}).upsert()
Parameters:

table (str) – The name of the table to update

Methods

set(fields)

Set the fields to update.

to_query()

Convert the operation to a query dictionary.

upsert([enable])

Enable upsert mode (insert if not exists).

where(condition)

Set the condition for which entries to update.

set(fields: Dict) Update

Set the fields to update.

Parameters:

fields (Dict) – The fields and values to set

Returns:

self for chaining

Return type:

Update

to_query() Dict

Convert the operation to a query dictionary.

upsert(enable: bool = True) Update

Enable upsert mode (insert if not exists).

Parameters:

enable (bool) – Whether to enable upsert, defaults to True

Returns:

self for chaining

Return type:

Update

where(condition: Dict) Update

Set the condition for which entries to update.

Parameters:

condition (Dict) – The condition to match entries

Returns:

self for chaining

Return type:

Update