예제 #1
0
        class Student(DynamoModel):
            _table_name_ = "Students"

            # Hash key
            name = Key()

            # Sort key
            year = Key()

            homeroom = Attr()
예제 #2
0
        class BigItem(DynamoModel):
            _table_name_ = "test_tab"
            pkey = Key()
            sortkey = Key()
            bigstring = Attr()

            def __eq__(self, other):
                if isinstance(other, BigItem):
                    return self.pkey == other.pkey and self.bigstring == other.bigstring
                return NotImplemented
예제 #3
0
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()
예제 #4
0
class ModelWithSortkey(DynamoModel):
    _table_name_ = "test_with_sort"

    hashkey = Key()

    sortkey = Key()

    another_attr = Attr()

    def __eq__(self, other):
        if isinstance(other, ModelWithSortkey):
            return (self.hashkey == other.hashkey
                    and self.sortkey == other.sortkey
                    and self.another_attr == other.another_attr)
        return NotImplemented
예제 #5
0
        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
예제 #6
0
        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
예제 #7
0
        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