Exemplo n.º 1
0
class Students(db.Model):
    __tablename__ = 'people'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50))
    sex = db.Column(db.Boolean)
    age = db.Column(db.Integer)
    class_id = db.Column(db.Integer, db.ForeignKey('class.id'))
Exemplo n.º 2
0
class Article(db.Model):
    '''文章'''
    __tablename__ = 'article'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, nullable=False, index=True)
    title = db.Column(db.String(32), nullable=False, index=True)
    content = db.Column(db.Text)
    created = db.Column(db.DateTime, nullable=False)
Exemplo n.º 3
0
class UserInfo(db.Model):
    __tablename__ = 'user_info'
    __table_args__ = {'mysql_collate': 'utf8_general_ci'}
    openid = db.Column(db.String(50), primary_key=True)
    nickName = db.Column(db.String(20))
    gender = db.Column(db.String(5))
    city = db.Column(db.String(20))
    province = db.Column(db.String(20))

    def __repr__(self):
        return '<UserInfo {}>'.format(self.openid)
Exemplo n.º 4
0
class User(db.Model):
    __table__name = 'users'
    id = db.Column(db.String, primary_key=True)
    name = db.Column(db.String())

    def save(self):
        db.session.add(self)
        db.session.commit()

    @classmethod
    def get_all(cls):
        return User.query.all()
Exemplo n.º 5
0
class Users(db.Model):
    # 定义表名字
    __tablename__ = 'users'

    # id name age sex
    # id代表生成的table的一列,name,age,sex以此类推
    # db.Integer 列的数据类型
    
    id = db.Column(db.Integer,primary_key=True)
    name = db.Column(db.String(50),unique=True)
    age = db.Column(db.Integer)
    sex = db.Column(db.Boolean)
    address = db.Column(db.String(90))
Exemplo n.º 6
0
class CachedTweet(db.Model):
    """
    A primordial Tweet that exists only in the Registry
    """
    __bind_key__ = 'registry'

    # The tweet's GameFrame ID
    tweet_id = db.Column(db.Integer, primary_key=True)

    # The game that tweet was collected on
    game_id = db.Column(db.Integer)

    # The tweet's Twitter data
    twitter_data = db.Column(db.JSON)
Exemplo n.º 7
0
class CachedVideo(db.Model):
    """
    A primordial Video that exists only in the Registry
    """
    __bind_key__ = 'registry'

    # The video's GameFrame ID
    video_id = db.Column(db.Integer, primary_key=True)

    # The game that video was collected on
    game_id = db.Column(db.Integer)

    # The video's YouTube data
    youtube_data = db.Column(db.JSON)
Exemplo n.º 8
0
class CachedDeveloper(db.Model):
    """
    A primordial Developer that exists only in the Registry
    """
    __bind_key__ = 'registry'

    # The developer's GameFrame ID
    developer_id = db.Column(db.Integer, primary_key=True)

    # The developer's IGDB ID
    igdb_id = db.Column(db.Integer)

    # The developer's IGDB data
    igdb_data = db.Column(db.JSON)
Exemplo n.º 9
0
class KeyGoogle(db.Model):
    """
    An API key for YouTube
    """
    __bind_key__ = 'registry'
    """
    The Google timeout is 24 hours
    """
    timeout = 60 * 60 * 24

    # The key's ID
    key_id = db.Column(db.Integer, primary_key=True)

    # The API key
    api_key = db.Column(db.Text)
Exemplo n.º 10
0
class KeyTwitter(db.Model):
    """
    An API key for Twitter
    """
    __bind_key__ = 'registry'
    """
    The Twitter timeout is 15 minutes
    """
    timeout = 60 * 15

    # The key's ID
    key_id = db.Column(db.Integer, primary_key=True)

    # The API key
    api_key = db.Column(db.Text)
Exemplo n.º 11
0
class KeyIgdb(db.Model):
    """
    An API key for IGDB
    """
    __bind_key__ = 'registry'
    """
    The IGDB timeout is 1 month
    """
    timeout = 60 * 60 * 24 * 30

    # The key's ID
    key_id = db.Column(db.Integer, primary_key=True)

    # The API key
    api_key = db.Column(db.Text)
Exemplo n.º 12
0
class KeyNewsapi(db.Model):
    """
    An API key for NewsAPI
    """
    __bind_key__ = 'registry'
    """
    The NewsAPI timeout is 24 hours
    """
    timeout = 60 * 60 * 24

    # The key's ID
    key_id = db.Column(db.Integer, primary_key=True)

    # The API key
    api_key = db.Column(db.Text)
Exemplo n.º 13
0
class CachedArticle(db.Model):
    """
    A primordial Article that exists only in the Registry
    """
    __bind_key__ = 'registry'

    # The article's GameFrame ID
    article_id = db.Column(db.Integer, primary_key=True)

    # The game that article was collected on
    game_id = db.Column(db.Integer)

    # The article's Steam data
    steam_data = db.Column(db.JSON)

    # The developer's IGDB data
    newsapi_data = db.Column(db.JSON)
Exemplo n.º 14
0
class User(db.Model):
    __tablename__ = 'user'

    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20),
                         nullable=False,
                         unique=True,
                         index=True)
    password = db.Column(db.String(20))
    gender = db.Column(db.Enum(Gender), default='unknow')
    city = db.Column(db.String(20), nullable=False)
    birthday = db.Column(db.Date, default='1990-01-01')
    bio = db.Column(db.Text)
Exemplo n.º 15
0
class CachedGame(db.Model):
    """
    A primordial Game that exists only in the Registry
    """
    __bind_key__ = 'registry'

    # The game's GameFrame ID
    game_id = db.Column(db.Integer, primary_key=True)

    # The game's Steam AppID
    steam_id = db.Column(db.Integer)

    # The game's Steam data
    steam_data = db.Column(db.JSON)

    # The game's IGDB ID
    igdb_id = db.Column(db.Integer)

    # The game's IGDB data
    igdb_data = db.Column(db.JSON)

    # The game's most recent VINDEX
    vindex = db.Column(db.Integer)
Exemplo n.º 16
0
class Classes(db.Model):
    __tablename__ = 'class'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50))
    classNum = db.Column(db.Integer)
    class_ship = relationship('Students', backref='cla')