Classlevel Operations

Every model comes with several class-level methods to simplify the process of generating requests to DynamoDB.

GetItem

Please see the GetRequest api for its full usage.

person = Person.get.key(Person.email == 'test@test.com').execute().item

Query

Please see the QueryRequest api for its full usage.

response = Person.query.key(Person.email == "test@test.com").execute()
for person in response.items:
    person.as_item()

Scan

Please see the ScanRequest api for its full usage.

response = Person.scan.filter(Person.name == "Mom").execute()
for person in response.items:
    person.as_item()

PutItem

Please see the PutRequest api for its full usage.

Person.put.item({"email": {"S": "test@test.com"}}).execute()

UpdateItem

Please see the UpdateRequest api for its full usage.

Person.update \
    .key(Person.email == 'test@test.com') \
    .set(Person.name, 'Mommy') \
    .execute()

DeleteItem

Please see the DeleteItem api for its full usage.

Person.delete.key(Person == 'test@test.com').execute()