Beispiel #1
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    body = db.Column(db.String(200))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)

    
Beispiel #2
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), unique=False)
    body = db.Column(db.String(200))
    timestamp = db.Column(db.DateTime, default=datetime.now, index=True)
    def __repr__(self):
        return 'Message %r'% self.name
Beispiel #3
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.String(200))
    name = db.Column(db.String(20))
    # 存储每一条信息的发表时间,这里的是datetime.now的原因是传入对象方法,在插入对象时才执行
    # 不在使用.now 而是 .utcnow ,获取不包含时间信息的时间戳UTC(coordinated universal time)
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #4
0
class Message(db.Model):
    ### id为整型,作为主键
    id = db.Column(db.Integer, primary_key=True)
    ### name为长度不超过20的字符串
    name = db.Column(db.String(20))
    ### body为长度不超过200的字符串
    body = db.Column(db.String(200))
    ### timestamp为时间日期
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #5
0
class Message(db.Model):

    __table_args__ = {'extend_existing': True}

    id = db.Column(db.Integer, primary_key=True)
    c_type = db.Column(db.String(20))
    body = db.Column(db.String(200))
    nl_body = db.Column(db.String(200))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #6
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.String(200))
    name = db.Column(db.String(20))
    timestamp = db.Column(db.DateTime, default=datetime.now, index=True)


#创建数据库表格
#db.create_all()
Beispiel #7
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    username = db.Column(db.String(20))  # 用户名
    password_hash = db.Column(db.String(128))  # 密码散列值

    def set_password(self, password):  # 用来设置密码的方法,接受密码作为参数
        self.password_hash = generate_password_hash(password)  # 将生成的密码保持到对应字段

    def validate_password(self, password):  # 用于验证密码的方法,接受密码作为参数
        return check_password_hash(self.password_hash, password)  # 返回布尔值
Beispiel #8
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.String(200))
    name = db.Column(db.String(20))
    # 时间戳
    # 如果传入的时间戳不是方法对象而是方法本身,那么在加载模块时这个函数就会被执行,时间戳的值就不正确
    # 为了让不同时区的用户能看到自己的时间,一个简单的方法是通过JS在用户自己的浏览器进行时间转换
    # 为了能够在不同时区的客户端进行时间转换,需要在服务器端提供纯正的时间(naive time),即不包含时区信息的时间戳
    # 与之相对,包含时区的时间戳被称为细致的时间(aware time)
    # datetime.utcnow()方法用来生成当前的UTC纯正时间
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #9
0
class Information(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    Age = db.Column(db.Integer)
    Income = db.Column(db.Float())
    Height = db.Column(db.Float())
    Weight = db.Column(db.Float())
    Marriage = db.Column(db.String())
    Card_ID = db.Column(db.String())
    Sex = db.String(db.String())
Beispiel #10
0
class Diary(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    mood = db.Column(db.String)
    body = db.Column(db.Text)
    time = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #11
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.String(200))
    name = db.Column(db.String(20))
    # Note : not datatime.now(),否则将在加载模块时就被执行,不是正确的时间戳
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
Beispiel #12
0
class Message(db.Model):
    id = db.Column(db.Integer, autoincrement=True, primary_key=True)
    name = db.Column(db.String(20))
    body = db.Column(db.String(256))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow)
Beispiel #13
0
class User(db.Model):
    __tablename__ = 'keep_user'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(20), unique=True)
    password = db.Column(db.String(200))
    Message = db.relationship('Message')
Beispiel #14
0
class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    body = db.Column(db.String(200))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
    userid = db.Column(db.Integer, db.ForeignKey('keep_user.id'))
class train_Information(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    Age = db.Column(db.Integer)
    Income = db.Column(db.Float())
    Height = db.Column(db.Float())
    Weight = db.Column(db.Float())
    Sex = db.Column(db.String())
    Marriage = db.Column(db.String())
    Deposit = db.Column(db.Float())
    Specific = db.Column(db.Boolean)
    Family_insured = db.Column(db.Boolean)
    Insurance = db.Column(db.String())