标签:highlight map sel end sql class self attr 查询
class MixToJson: def single_to_dict(self): return {c.name: getattr(self, c.name) for c in self.__table__.columns} def dobule_to_dict(self): result = {} for key in self.__mapper__.c.keys(): if getattr(self, key) is not None: result[key] = str(getattr(self, key)) else: result[key] = getattr(self, key) return result @staticmethod def to_json(all_vendors): v = [ven.dobule_to_dict() for ven in all_vendors] return v
继承混入以上类
标签:highlight map sel end sql class self attr 查询
原文地址:https://www.cnblogs.com/john-xiong/p/13294625.html