base.py 592 Bytes
Newer Older
1 2 3 4 5 6 7 8
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name  : base.py
# @Time       : 2020/11/18 下午12:47
# @Author     : X. Peng
# @Email      : acepengxiong@163.com
# @Software   : PyCharm
# -----------------------------------------------------------------------------
赵杰's avatar
赵杰 committed
9
from sqlalchemy.ext.declarative import declarative_base
10
Base = declarative_base()
赵杰's avatar
赵杰 committed
11 12


13 14 15 16 17 18 19 20
class BaseModel():
    """."""

    def __init__(self):
        pass

    def to_dict(self):
        return {c.name: getattr(self, c.name) for c in self.__table__.columns}
21 22