class FriendModel(BaseModel): """ A model for testing """ Type = UnicodeAttribute(default='friend') Name = UnicodeAttribute(null=True) Description = UnicodeAttribute(null=True) CreatedAt = UTCDateTimeAttribute(default=datetime.utcnow())
class TypeIndex(GlobalSecondaryIndex): """ Type Index """ class Meta: # pylint: disable=too-few-public-methods """ GSI properties """ index_name = 'Type' projection = AllProjection() Type = UnicodeAttribute(default='person', hash_key=True) sk = UnicodeAttribute(range_key=True)
class BaseModel(Model): '''Base model with meta''' class Meta(Model.Meta): ''' Table properties ''' table_name = os.environ.get('DYNAMODB_TABLE') PK = UnicodeAttribute(hash_key=True) SK = UnicodeAttribute(range_key=True) TypeIndex = TypeIndex()
class TypeIndex(GlobalSecondaryIndex): class Meta: index_name = 'Type' billing_mode = 'PAY_PER_REQUEST' projection = AllProjection() Type = UnicodeAttribute(default='project', hash_key=True) SK = UnicodeAttribute(range_key=True)
class Person(BaseModel): Type = UnicodeAttribute(default='person') FirstName = UnicodeAttribute() LastName = UnicodeAttribute() Age = NumberAttribute(default=0) CreateDate = UTCDateTimeAttribute(attr_name='CreateDateTime') ValueList = ListAttribute() ValueMap = MapAttribute() DoesNotExist = DoesNotExist
class FriendToUpdate(BaseModel): ''' A model for a friend that has lots of fun things to update ''' Type = UnicodeAttribute(default='update_friend') NumberAttr = NumberAttribute(null=True) SetAttr = UnicodeSetAttribute(null=True) ListAttr = ListAttribute(null=True) StringAttr = UnicodeAttribute(null=True)
class BaseModel(Model): '''Base model with meta''' class Meta(Model.Meta): table_name = 'falcano-e2e' billing_mode = 'PAY_PER_REQUEST' PK = UnicodeAttribute(hash_key=True) SK = UnicodeAttribute(range_key=True) TypeIndex = TypeIndex()
class MyModel(Model): class Meta(Model.Meta): table_name = 'falcano-map-attr-e2e' billing_mode = 'PAY_PER_REQUEST' PK = UnicodeAttribute(hash_key=True) SK = UnicodeAttribute(range_key=True) outer_map = OuterMapAttribute() outer_list = ListAttribute() Type = UnicodeAttribute(default='test_nested_map')
class TestModel(Model): '''Test model with meta''' class Meta(Model.Meta): table_name = 'falcano-map-attr-e2e' billing_mode = 'PAY_PER_REQUEST' PK = UnicodeAttribute(hash_key=True) SK = UnicodeAttribute(range_key=True) Data = MapAttribute() Type = UnicodeAttribute(default='test_map_attribute')
class Person(BaseModel): Type = UnicodeAttribute(default='person') FirstName = UnicodeAttribute() LastName = UnicodeAttribute() Age = NumberAttribute() DoesNotExist = DoesNotExist
class TestCustomAttrMap(MapAttribute): overridden_number_attr = NumberAttribute(attr_name="number_attr") overridden_unicode_attr = UnicodeAttribute(attr_name="unicode_attr")
class MyModel(Model): key = UnicodeAttribute(hash_key=True) outer_map = OuterMapAttribute()
class TestDefaultsMap(MapAttribute): map_field = MapAttribute(default={}) string_field = UnicodeAttribute(null=True)
class FriendGroup(BaseModel): ''' A model for a friendgroup ''' Type = UnicodeAttribute(default='friend_group') Name = UnicodeAttribute(null=True)