Exemplo n.º 1
0
    class ProjectionOverlap(BaseModel):
        hash = Column(Integer, hash_key=True)
        range = Column(Integer, range_key=True)
        other = Column(Integer)

        by_other = GlobalSecondaryIndex(projection=["other", "range"],
                                        hash_key="other")
Exemplo n.º 2
0
class GroupActivity(db.Model):
    id = Column(String, hash_key=True)
    group_id = Column(String)
    type = Column(String)
    object = Column(String)

    by_group = GlobalSecondaryIndex(projection="all", hash_key="group_id")
Exemplo n.º 3
0
class User(BaseModel):
    id = Column(String, hash_key=True)
    age = Column(Integer)
    name = Column(String)
    email = Column(String)
    joined = Column(DateTime, dynamo_name="j")
    by_email = GlobalSecondaryIndex(hash_key="email", projection="all")
Exemplo n.º 4
0
    class MyModel(BaseModel):
        id = Column(Integer, hash_key=True)
        email = Column(String)

        password = Column(String, default=token_hex)

        by_email = GlobalSecondaryIndex(projection="keys", hash_key="email")
Exemplo n.º 5
0
    class Model(new_base()):
        id = Column(UUID, hash_key=True)
        other = Column(DateTime, range_key=True)
        another = Column(UUID)
        last = Column(String)

        by_last = GlobalSecondaryIndex(hash_key="another", range_key="last")
        by_another = LocalSecondaryIndex(range_key="last")
Exemplo n.º 6
0
    class SecondOverlap(BaseModel):
        class Meta:
            table_name = "overlap-table"

        id = Column(Integer, hash_key=True)
        second_value = Column(Integer)
        second_index = GlobalSecondaryIndex(projection="keys",
                                            hash_key="second_value")
Exemplo n.º 7
0
class MixinUser(MixinBase, IdentityMixin):
    first_name = Column(String)
    last_name = Column(String)
    by_email = GlobalSecondaryIndex(projection='all',
                                    dynamo_name='email-index',
                                    hash_key='email')

    def __str__(self):
        return "{} {}: {}".format(self.first_name, self.last_name, self.email)
Exemplo n.º 8
0
class ProjectedIndexes(BaseModel):
    h = Column(Integer, hash_key=True)
    r = Column(Integer, range_key=True)
    both = Column(String)
    neither = Column(String)
    gsi_only = Column(String)
    lsi_only = Column(String)

    by_gsi = GlobalSecondaryIndex(hash_key="h", projection=["both", "gsi_only"])
    by_lsi = LocalSecondaryIndex(range_key="r", projection=["both", "lsi_only"])
Exemplo n.º 9
0
    class ImplicitValues(BaseModel):
        class Meta:
            write_units = 1
            table_name = "throughput-test"

        id = Column(Integer, hash_key=True)
        other = Column(Integer)
        by_other = GlobalSecondaryIndex(projection="keys",
                                        hash_key=other,
                                        write_units=1)
Exemplo n.º 10
0
class Tweet(Base):
    class Meta:
        write_units = 10

    account = Column(UUID, hash_key=True)
    id = Column(String, range_key=True)
    content = Column(String)
    date = Column(DateTime(timezone='EU/Paris'))
    favorites = Column(Integer)

    by_date = GlobalSecondaryIndex(hash_key='date', projection='keys_only')
Exemplo n.º 11
0
class Account(Base):
    class Meta:
        read_units = 5
        write_units = 2

    id = Column(UUID, hash_key=True)
    name = Column(String)
    email = Column(String)
    by_email = GlobalSecondaryIndex(hash_key='email',
                                    projection='keys_only',
                                    write_units=1,
                                    read_units=5)
Exemplo n.º 12
0
class User(BaseModel):
    class Meta:
        read_units = 1
        write_units = 3

    email = Column(String, hash_key=True)
    username = Column(String, range_key=True)
    by_username = GlobalSecondaryIndex(projection="keys", hash_key="username")

    profile = Column(String)
    data = Column(DynamicMap)
    extra = Column(String)
Exemplo n.º 13
0
class ComplexModel(BaseModel):
    class Meta:
        write_units = 2
        read_units = 3
        table_name = "CustomTableName"

    name = Column(UUID, hash_key=True)
    date = Column(String, range_key=True)
    email = Column(String)
    joined = Column(String)
    not_projected = Column(Integer)
    by_email = GlobalSecondaryIndex(hash_key="email", read_units=4, projection="all", write_units=5)
    by_joined = LocalSecondaryIndex(range_key="joined", projection=["email"])
Exemplo n.º 14
0
class Brand(BaseModel):
    class Meta:
        table_name = 'brewoptix-brands'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    name = Column(String)
    supplier_id = Column(UUID)

    by_brand_name = GlobalSecondaryIndex(projection='all',
                                         hash_key='name',
                                         read_units=20,
                                         write_units=20)

    by_supplier_id = GlobalSecondaryIndex(projection='all',
                                          hash_key='supplier_id',
                                          read_units=20,
                                          write_units=20)
Exemplo n.º 15
0
class PurchaseOrder(BaseModel):
    class Meta:
        table_name = 'brewoptix-purchase-orders'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # API Attrs
    supplier_id = Column(UUID)
    distributor_id = Column(UUID)
    order_date = Column(Number)
    pack_date = Column(Number)
    ship_date = Column(Number)

    by_supplier_id_and_order_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='order_date',
    )

    by_supplier_id_and_pack_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='pack_date',
    )

    by_supplier_id_and_ship_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='ship_date',
    )

    by_distributor_id_and_order_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='distributor_id',
        range_key='order_date',
    )

    by_distributor_id_and_pack_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='distributor_id',
        range_key='pack_date',
    )

    by_distributor_id_and_ship_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='distributor_id',
        range_key='ship_date',
    )
Exemplo n.º 16
0
class Product(BaseModel):
    class Meta:
        table_name = 'brewoptix-products'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    supplier_id = Column(UUID)

    by_supplier_id = GlobalSecondaryIndex(projection='all',
                                          hash_key='supplier_id',
                                          read_units=20,
                                          write_units=20)
Exemplo n.º 17
0
class OnHand(BaseModel):
    class Meta:
        table_name = 'brewoptix-on-hand-inventory'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # API Attrs
    supplier_id = Column(UUID)
    product_id = Column(UUID)

    by_supplier_id = GlobalSecondaryIndex(projection='all',
                                          hash_key='supplier_id',
                                          read_units=20,
                                          write_units=20)
Exemplo n.º 18
0
class SupplierDistributor(BaseModel):
    class Meta:
        table_name = 'brewoptix-supplier-distributors'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    supplier_id = Column(UUID)
    name = Column(String)

    by_supplier_id = GlobalSecondaryIndex(projection='all',
                                          hash_key='supplier_id',
                                          read_units=20,
                                          write_units=20)
Exemplo n.º 19
0
class Production(BaseModel):
    class Meta:
        table_name = 'brewoptix-production'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    supplier_id = Column(UUID)
    production_date = Column(Number)  # unix timestamp

    by_supplier_id_and_production_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='production_date',
        read_units=20,
        write_units=20)
Exemplo n.º 20
0
class Count(BaseModel):
    class Meta:
        table_name = 'brewoptix-counts'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # API Attrs
    supplier_id = Column(UUID)
    count_date = Column(Number)

    by_supplier_id_and_count_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='count_date',
        read_units=20,
        write_units=20)
Exemplo n.º 21
0
class PackageType(BaseModel):
    class Meta:
        table_name = 'brewoptix-package-types'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    supplier_id = Column(UUID)

    by_supplier_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
    )
Exemplo n.º 22
0
class OnHand(BaseModel):
    class Meta:
        table_name = 'brewoptix-on-hand-inventory'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # API Attrs
    supplier_id = Column(UUID)
    product_id = Column(UUID)

    by_supplier_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
    )
Exemplo n.º 23
0
class Adjustment(BaseModel):
    class Meta:
        table_name = 'brewoptix-adjustment-inventory'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # API Attrs
    supplier_id = Column(UUID)
    adjustment_date = Column(Number)

    by_supplier_id_and_adjustment_date = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
        range_key='adjustment_date',
    )
Exemplo n.º 24
0
class DistributorSupplier(BaseModel):
    class Meta:
        table_name = 'brewoptix-distributor-suppliers'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)

    # Api attrs
    distributor_id = Column(UUID)
    supplier_distributor_id = Column(UUID)
    supplier_id = Column(UUID)
    nickname = Column(String)

    by_distributor_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='distributor_id',
    )
Exemplo n.º 25
0
class ExternalUser(MixinUser):
    company = Column(String)
    by_email = GlobalSecondaryIndex(projection='all',
                                    dynamo_name='email-index',
                                    hash_key=MixinUser.email)
Exemplo n.º 26
0
 class NextGenUser(MixinUser):
     version = Column(Integer)
     next_by_email = GlobalSecondaryIndex(projection='all', dynamo_name='email-index', hash_key='email')