from app import db class EntityBase(object): def to_json(self): fields = self.__dict__ if "_sa_instance_state" in fields: del fields["_sa_instance_state"] return fields class School(db.Model, EntityBase): """ 表名,字段名 """ __tablename__ = "school_list" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(255)) province = db.Column(db.String(255)) city = db.Column(db.String(255)) feature = db.Column(db.String(255)) hotValue = db.Column(db.String(255)) pic = db.Column(db.String(255)) category = db.Column(db.String(255)) batchTimes = db.Column(db.String(255)) class Csdn(db.Model, EntityBase): """ 表名,字段名 """ __tablename__ = "score" id = db.Column(db.Integer, primary_key=True) nickname = db.Column(db.String(255)) username = db.Column(db.String(255)) cateName = db.Column(db.String(255)) totalScore = db.Column(db.Float) regtime = db.Column(db.String(255))