在SQLAlchemy中,不能在modle类中创建虚拟列吗?

2024-06-10 07:56:36 发布

您现在位置:Python中文网/ 问答频道 /正文

在SQLAlchemy中,我想将虚拟列放入modle类中

class tableA(Base):
    __tablename__ = 'tableA'

    code = Column('code', String(10), primary_key=True)
    date_a = Column(DateTime)
    date_b = Column(DateTime)
    date_d = Column(func.DATEDIFF(date_a, date_b))

错误


Tags: keytruebasedatetimedatestringsqlalchemycode