示例#1
0
class User(orm.Model):
    id: orm.Integer(primary_key=True) = None
    name: orm.String(max_length=100)

    class Mapping:
        table_name = "users"
        metadata = metadata
        database = database
示例#2
0
class Organisation(orm.Model):
    id: orm.Integer(primary_key=True) = None
    ident: orm.String(max_length=100)

    class Mapping:
        table_name = "org"
        metadata = metadata
        database = database
示例#3
0
class Member(orm.Model):
    id: orm.Integer(primary_key=True) = None
    team: orm.ForeignKey(Team)
    email: orm.String(max_length=100)

    class Mapping:
        table_name = "member"
        metadata = metadata
        database = database
示例#4
0
class Team(orm.Model):
    id: orm.Integer(primary_key=True) = None
    org: orm.ForeignKey(Organisation)
    name: orm.String(max_length=100)

    class Mapping:
        table_name = "team"
        metadata = metadata
        database = database
示例#5
0
class Product(orm.Model):
    id: orm.Integer(primary_key=True) = None
    name: orm.String(max_length=100)
    rating: orm.Integer(minimum=1, maximum=5)
    in_stock: orm.Boolean() = False

    class Mapping:
        table_name = "products"
        metadata = metadata
        database = database
示例#6
0
class Track(orm.Model):
    id: orm.Integer(primary_key=True) = None
    album: orm.ForeignKey(Album)
    title: orm.String(max_length=100)
    position: orm.Integer()

    class Mapping:
        table_name = "track"
        metadata = metadata
        database = database
示例#7
0
class Note(orm.Model):
    id: orm.Integer(primary_key=True) = None
    text: orm.String(max_length=100)
    completed: orm.Boolean() = False
    number: orm.Decimal(scale=6, precision=20, max_digits=13,
                        decimal_places=6) = '0'

    class Mapping:
        table_name = "notes"
        database = database
        metadata = metadata