通过__tablename__ = 'xxx' #定义表名

from datetime import datetime

from exts import db

class User(db.Model):
    __tablename__ = 'user1' #定义表名

    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    username = db.Column(db.String(10), nullable=True)

    password = db.Column(db.String(256), nullable=True)
    phone = db.Column(db.String(11),nullable=True,unique=True)
    rdatetime = db.Column(db.DateTime,default  =datetime.now)
    isdelete = db.Column(db.Boolean,default=False)
    def __str__(self):
        return self.username

 

你可能感兴趣的:(Flask,Python之路)