ByteBuffer

class cerami.datatype.ByteBuffer(translator_cls=<class 'cerami.datatype.translator.byte_translator.ByteTranslator'>, default=None, column_name='')

A class for all ByteBuffer and Binary datatypes

__init__(translator_cls=<class 'cerami.datatype.translator.byte_translator.ByteTranslator'>, default=None, column_name='')

constructor for the ByteBuffer

Parameters
  • default – a default value for the column. It can be a value or function

  • column_name – a string defining the name of the column on the table

  • translator_cls – a translator class to manipulate data to/from dynamodb. Defaults to the ByteTranslator

between(greater_than, less_than)

Build a BetweenExpression

BetweenExpression can be used with the filter() on the model or as a KeyConditionExpression on the sort key of a query

Parameters
  • greater_than – a value that the query is greater than or equal to

  • less_than – a value that the query is less than or equal to

Returns

A BetweenExpression

For example:

Person.scan.filter(Person.age.between(10, 20))
build(val)

build the column value based on the val passed in

building is called automatically by the DynamoDataAttribute when the model is initialized. It will use the default value when present if the val passed in is None

Parameters

val – A value that will be used to build the attribute on the instance

Returns

The passed in val or the default when the default is set

in_(*values)

Build an InExpression

InExpressions can only be used with filter() on the model, it cannot be part of a KeyConditionExpression. The will filter for the table for values that match exactly any of the values passed in as arguments

Parameters

values – anything value to use to filter the table

Returns

An InExpression

For example:

Person.scan.filter(Person.name.in_("Mom", "Dad"))
set_column_name(val)

Update the column_name of this instance

Parameters

value – a string for the new column name