Esempio n. 1
0
class Hero(BaseModel):
    __tablename__ = 'hero'
    __bind_key__ = 'e7db'
    heroname = db.Column(db.String(64))
    constellation = db.relationship('Constellation',
                                    secondary=hero_constellations,
                                    backref='heros')
    nicename = db.relationship('Nicename', backref='heros')

    def keys(self):
        return 'heroname'

    def __repr__(self):
        return f'{self.heroname}'
Esempio n. 2
0
class Constellation(BaseModel):
    __bind_key__ = 'e7db'
    __tablename__ = 'constellation'
    constellation = db.Column(db.String(16))
    # 反查询英雄表
    hero = db.relationship('Hero',
                           lazy='subquery',
                           secondary=hero_constellations,
                           backref=db.backref('constellations', lazy=True))
    # 反查询 催化剂表
    catalyst = db.relationship('Catalyst',
                               lazy='subquery',
                               secondary=constellation_catalyst,
                               backref=db.backref('constellations', lazy=True))

    def __repr__(self):
        return f'{self.constellation}'
Esempio n. 3
0
class Catalyst(BaseModel):
    __bind_key__ = 'e7db'
    __tablename__ = 'catalyst'
    catalyst = db.Column(db.String(16))
    # qb的图片地址
    qbaddr1 = db.Column(db.String(64))
    # web端的图片地址
    webaddr2 = db.Column(db.String(64))
    # 反查询星座表
    constellation = db.relationship('Constellation',
                                    lazy='subquery',
                                    secondary=constellation_catalyst,
                                    backref=db.backref('catalysts', lazy=True))
    # 反查询 商店表
    shop = db.relationship('Shop',
                           lazy='subquery',
                           secondary=catalyst_shop,
                           backref=db.backref('catalysts', lazy=True))

    def __repr__(self):
        return f'{self.catalyst}'
Esempio n. 4
0
class Shop(BaseModel):
    __bind_key__ = 'e7db'
    __tablename__ = 'shop'
    shop = db.Column(db.String(32))
    # 反查询 催化剂表
    catalyst = db.relationship('Catalyst',
                               lazy='subquery',
                               secondary=catalyst_shop,
                               backref=db.backref('shops', lazy=True))

    def __repr__(self):
        # 打印结果  商店
        return f'{self.shop}'
Esempio n. 5
0
class Nicename(BaseModel):
    __tablename__ = 'nicename'
    __bind_key__ = 'e7db'
    nicename = db.Column(db.String(64))
    hero_id = db.Column(db.Integer, db.ForeignKey('hero.id'))
    constellation = db.relationship('Hero',
                                    lazy='subquery',
                                    backref='nicenames')

    def keys(self):
        return 'nicename'

    def __repr__(self):
        return f'{self.heroname}'