aito.client.requests.modify_operations
Helper classes for Aito Modify API operations.
These classes provide a fluent interface for building modify queries:
from aito.client.requests import Insert, Update, Delete
import aito.api as api
# Insert a single entry
api.modify(client, Insert("products", {"id": "1", "name": "Apple"}))
# Insert multiple entries
entries = [{"id": "1", "name": "Apple"}, {"id": "2", "name": "Banana"}]
api.modify(client, Insert("products", entries))
# Update entries matching a condition
api.modify(client, Update("products").where({"id": "1"}).set({"name": "New Name"}))
# Update with upsert (insert if not exists)
api.modify(client, Update("products").where({"id": "1"}).set({"name": "Name"}).upsert())
# Delete entries matching a condition
api.modify(client, Delete("products", {"id": "1"}))
# Multiple operations atomically
ops = [Insert("products", {"id": "1", "name": "Apple"}),
Update("products").where({"id": "2"}).set({"name": "Banana"}),
Delete("products", {"id": "3"})]
api.modify(client, ops)
Classes
|
Delete operation for the Modify API. |
|
Insert operation for the Modify API. |
Base class for modify operations. |
|
|
Update operation for the Modify API. |