class BigItem(DynamoModel): _table_name_ = "test_tab" pkey = Key() bigstring = Attr() def __eq__(self, other): if isinstance(other, BigItem): return self.pkey == other.pkey and self.bigstring == other.bigstring return NotImplemented
class Student(DynamoModel): _table_name_ = "Students" # Hash key name = Key() # Sort key year = Key() homeroom = Attr()
class Model(DynamoModel): _table_name_ = "diff_attr_table" hash_key = Key("actual_key_name") an_attr = Attr("actual_attr_name") def __eq__(self, other): if isinstance(other, Model): return (self.hash_key == other.hash_key and self.an_attr == other.an_attr) return NotImplemented
class Movie(DynamoModel): _table_name_ = "Movies" #: Year the film was made (hash key) year = Key() #: Title of the film (sort key) title = Key() #: Additional information about the film info = Attr()
class ModelWithoutSortkey(DynamoModel): _table_name_ = "test_without_sort" hashkey = Key() another_attr = Attr() def __eq__(self, other): if isinstance(other, ModelWithoutSortkey): return (self.hashkey == other.hashkey and self.another_attr == other.another_attr) return NotImplemented
class ByHomeroomIndex(DynamoModel): _table_name_ = "Students" _index_name_ = "ByHomeroom" homeroom = Key() name = Key() year = Attr() def __eq__(self, other): if isinstance(other, ByHomeroomIndex): return ((self.name == other.name) & (self.homeroom == other.homeroom) & (self.year == other.year)) return NotImplemented
class Student(DynamoModel): _table_name_ = "Students" # Hash key name = Key() # Sort key year = Key() homeroom = Attr() def __eq__(self, other): if isinstance(other, Student): return ((self.name == other.name) & (self.year == other.year) & (self.homeroom == other.homeroom)) return NotImplemented