Responses

Response

class cerami.response.Response(response, reconstructor)

A BaseClass to handle the response from a Request

All Request.execute() calls make a request to DynamoDB which returns the records and extra meta data about the request. A Response object is responsible for interpreting this data

reconstructor

a Reconstructor object to help interpret data

_raw

The entire response objected returned from DynamoDB

__init__(response, reconstructor)

constructor for a Response

Parameters
  • response – a dict returned from DynamoDB based on a Request.execute() call

  • reconstructor – a Reconstructor object to help interpret data

SearchResponse

class cerami.response.SearchResponse(response, reconstructor)

A Response class to handle SearchRequest

A SearchResponse is returned from a ScanRequest or QueryRequest

count

The number of records returned

scanned_count

I dont really know how this one works yet

last_evaluated_key

The primary key of the item where the operation stopped, inclusive of the result set. Can be used for pagination for the start value in the next query.

_items

The raw data of all records in the result set

__init__(response, reconstructor)

Constructor for SearchResponse

Parameters
  • response – a dict from DynamoDB typically from a scan or query request

  • reconstructor – a Reconstructor object to help interpret data

property items

A generator to get individual items from the response

Whenever an item is yielded, it will reconstruct the item using the reconstructor

Returns

A generator to iterate over items in the response

For example:

response = Person.scan.filter(Person.age < 100).execute()
for person in response.items:
    print(person.name)

GetResponse

class cerami.response.GetResponse(response, reconstructor)

A Response class to handle GetRequest

item

The reconstructed data from the response Item It will be None if the response for some reason is missing the Item key.

__init__(response, reconstructor)

constructor for GetResponse

Parameters
  • response – a dict from DynamoDB typically from a get_item request

  • reconstructor – a Reconstructor object to help interpret data

SaveResponse

class cerami.response.SaveResponse(response, reconstructor)

A Response class to handle saves requests

SaveResponses are generated through PutRequest and UpdateRequest

__init__(response, reconstructor)

constructor for SaveResponse

Parameters
  • response – a dict from DynamoDB typicall from put_item or update_item

  • reconstructor – a Reconstructor object to help interpret data

DeleteResponse

class cerami.response.DeleteResponse(response, reconstructor)

A Response class to handle DeleteRequest

__init__(response, reconstructor)

constructor for a Response

Parameters
  • response – a dict returned from DynamoDB based on a Request.execute() call

  • reconstructor – a Reconstructor object to help interpret data