最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]SQLAlchemy设置默认值出错:sqlalchemy.exc.ArgumentError: Unknown arguments passed to Column defaut

SQLAlchemy crifan 6536浏览 0评论

代码:

class Event(db.Model):
    __tablename__ = “events”
    title = db.Column(db.String(128), defaut = “”)

出错:

  File “/usr/share/nginx/html/SIPEvents/sipevents/models.py”, line 103, in Event
    title = db.Column(db.String(128), defaut = “”)
  File “/root/Envs/SIPEvents/lib/python2.7/site-packages/sqlalchemy/sql/schema.py”, line 1232, in __init__
    “Unknown arguments passed to Column: ” + repr(list(kwargs)))
sqlalchemy.exc.ArgumentError: Unknown arguments passed to Column: [‘defaut’]

搜:

sqlalchemy.exc.ArgumentError: Unknown arguments passed to Column: [‘defaut’]

sqlalchemy Column  defaut

python – marking columns in sqlalchemy tables – Stack Overflow

python – enforce column encoding with sqlalchemy – Stack Overflow

sqlalchemy Column  默认值

python – Setting a default value in sqlalchemy – Stack Overflow

Flask SQLAlchemy 表字段默认值 – 自由自我 – 51CTO技术博客

SQLAlchemy中设置Column的默认值 – Fisher的专栏 – 博客频道 – CSDN.NET

->后来才注意到,原来是笔误。应该是:

default

title = db.Column(db.String(128), default = “”)

转载请注明:在路上 » [已解决]SQLAlchemy设置默认值出错:sqlalchemy.exc.ArgumentError: Unknown arguments passed to Column defaut

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.189 seconds, using 22.05MB memory