Exemple #1
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")
class Deployment(BaseModel):
    class Meta:
        table_name = 'sp-deployment'
        billing = {"mode": "on_demand"}

    script_number = Column(Number, range_key=True)
    stage = Column(String, hash_key=True)
Exemple #3
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")
Exemple #4
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")
class Payments(BaseModel):
    class Meta:
        table_name = 'brewoptix-payments'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

    # big 8
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)
    user_id = Column(UUID)
    timestamp = Column(Number)

    # API attrs
    email = Column(String)

    by_user_id_and_timestamp = GlobalSecondaryIndex(
        projection='all',
        hash_key='user_id',
        range_key='timestamp',
    )

    by_email_and_timestamp = GlobalSecondaryIndex(
        projection='all',
        hash_key='email',
        range_key='timestamp',
    )
Exemple #6
0
class Paste(SortByVersion, BaseModel):
    class Meta:
        ttl = {"column": "not_after"}

    not_after = Column(Timestamp, default=new_expiry)
    bucket = Column(String, dynamo_name="b")
    key = Column(String, dynamo_name="k")
class SupplierDistributor(BaseModel):
    class Meta:
        table_name = 'brewoptix-supplier-distributors'
        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)
    name = Column(String)
    access_code = Column(String, default='')

    by_supplier_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
    )

    by_access_code = GlobalSecondaryIndex(
        projection='all',
        hash_key='access_code',
    )
class Brand(BaseModel):
    class Meta:
        table_name = 'brewoptix-brands'
        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
    name = Column(String)
    supplier_id = Column(UUID)

    by_brand_name = GlobalSecondaryIndex(
        projection='all',
        hash_key='name',
    )

    by_supplier_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='supplier_id',
    )
Exemple #9
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")
class Profile(BaseModel):
    class Meta:
        table_name = 'brewoptix-users'
        read_units_min = 2
        read_units_max = 20
        write_units_min = 2
        write_units_max = 20
        autoscale_table = True
        autoscale_all_indices = True

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

    # API attrs
    user_id = Column(UUID)
    affiliate_id = Column(String, default='')
    email = Column(String)

    # this index can be used for checking affiliate_id collision
    by_affiliate_id = GlobalSecondaryIndex(
        projection='keys',
        hash_key='affiliate_id',
    )

    by_user_id = GlobalSecondaryIndex(
        projection='all',
        hash_key='user_id',
    )

    by_email = GlobalSecondaryIndex(
        projection='all',
        hash_key='email',
    )
Exemple #11
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")
Exemple #12
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")
Exemple #13
0
class SomeDataBlob(BaseModel):
    class Meta:
        stream = {
            "include": {"new", "old"}
        }

    id = Column(UUID, hash_key=True)
    uploaded = Column(DateTime, range_key=True)
Exemple #14
0
class User(BaseModel):
    class Meta:
        read_units = 1
        write_units = 3

    email = Column(String, hash_key=True)
    username = Column(String, range_key=True)

    profile = Column(String)
Exemple #15
0
class MixinBase(BaseModel, UUIDHashKey, CreatedRangeKey):
    class Meta:
        abstract = True

    email = Column(String)
    updated = Column(DateTime)
    active = Column(Boolean)
    by_created = LocalSecondaryIndex(projection="all",
                                     range_key=CreatedRangeKey.created)
Exemple #16
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)
class Distributor(BaseModel):
    class Meta:
        table_name = 'brewoptix-distributors'
        read_units = 20
        write_units = 20

    # big 7
    entity_id = Column(UUID, hash_key=True)
    version = Column(UUID, range_key=True)
Exemple #18
0
class Group(db.Model):
    type = "Group"
    id = Column(String, hash_key=True)
    name = Column(String)
    summary = Column(String)
    private_key = Column(RSAKey(False), default=new_key)

    @property
    def public_key(self):
        return extract_public_key(self.private_key)
Exemple #19
0
class ObservedActivity(db.Model):
    observer = Column(String, hash_key=True)
    date = Column(DateTime,
                  range_key=True,
                  default=lambda: datetime.now(timezone.utc))
    type = Column(String, default="")

    source_host = Column(String, default="")

    object = Column(String, default="")
Exemple #20
0
class GroupMember(db.Model):
    id = Column(UUID, hash_key=True)
    group_id = Column(String)
    follower_id = Column(String)
    is_admin = Column(Boolean, default=False)

    by_group = GlobalSecondaryIndex(projection=["follower_id"],
                                    hash_key="group_id")
    by_follower = GlobalSecondaryIndex(projection=["group_id", "is_admin"],
                                       hash_key="follower_id")
class ScrapedData(BaseModel):
    class Meta:
        write_units = 5
        table_name = "teascraper.ScrapedData"

    id = Column(String, hash_key=True, dynamo_name="id")
    date = Column(DateTime, range_key=True, dynamo_name="sd")
    quantity = Column(Integer, dynamo_name="q")
    url = Column(String, dynamo_name="u")
    price = Column(Integer, dynamo_name="p")
Exemple #22
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)
Exemple #23
0
class QueueEntry(BaseModel):
    LAST_SEEN_ID = None

    class Meta:
        table_name = "pqs-queue-entry"
        stream = {"include": {"new", "old"}}

    position = Column(Integer, hash_key=True)
    id = Column(String)
    enqueued_at = Column(DateTime)
    served_at = Column(DateTime)
Exemple #24
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')
class Supplier(BaseModel):
    class Meta:
        table_name = 'brewoptix-suppliers'
        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)
Exemple #26
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)
Exemple #27
0
class VectorModel(BaseModel):
    name = Column(String, hash_key=True)
    list_str = Column(List(String))
    set_str = Column(Set(String))
    map_nested = Column(Map(**{
        "bytes": Binary,
        "str": String,
        "map": Map(**{
            "int": Integer,
            "str": String
        })
    }))
Exemple #28
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)
Exemple #29
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"])
Exemple #30
0
    class Model(new_base()):
        id = Column(UUID, hash_key=True)
        other = Column(UUID, range_key=True)
        another = Column(UUID)
        date = Column(DateTime)
        boolean = Column(Boolean)

        g_all = Global(hash_key="another", range_key="date", projection="all")
        g_key = Global(hash_key="another", projection="keys_only")
        g_inc = Global(hash_key="other", projection=["another", "date"])

        l_all = Local(range_key="another", projection="all")
        l_key = Local(range_key="another", projection="keys_only")
        l_inc = Local(range_key="another", projection=["date"])