from Context.common import common_db from sqlalchemy import Column, Integer, String, DateTime, func class UploadFile(common_db.Base): __tablename__ = 'upload_file' md = Column(String(255), primary_key=True, comment='文件md') file_name = Column(String(255), comment='文件名称') mime_type = Column(String(255), comment='文件mime_type') user_id = Column(String(255), comment='上传的用户id') common_type = Column(String(255), comment='大分类的文件类型') create_time = Column(DateTime, server_default=func.now(), comment='上传时间') file_url = Column(String(500), comment='文件链接') def to_dict(self): return {c.name: getattr(self, c.name) for c in self.__table__.columns}