gpt4 book ai didi

python - SQLAlchemy 类型对象 'Date' 没有属性 '_set_parent_with_dispatch'

转载 作者:行者123 更新时间:2023-11-28 18:36:59 24 4
gpt4 key购买 nike

我正在使用 sqlalchemy 和简单模型模式。

  class Mail(Base):
__tablename__ = 'mail'

id = Column(Integer, primary_key=True)
date = Column(Date, nullable=False)

我犯了愚蠢的错误

AttributeError: type object 'Date' has no attribute '_set_parent_with_dispatch'

我尝试了最新版本的 sqlalchemy 1.0.6,以及之前的版本,甚至是非常旧的版本 0.7.x — 到处都是同样的错误。

此文件的第 72 行 https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/sql/schema.py#L72

最佳答案

虽然您的问题似乎没有这个问题,但错误的参数排序可能会导致类似的错误。检查 Column() 中变量的顺序。如果它们顺序不对,就会出现此错误。

希望对您有所帮助。

关于python - SQLAlchemy 类型对象 'Date' 没有属性 '_set_parent_with_dispatch',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31443864/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com