SqlAlchemy won't accept datetime.datetime.now value in a DateTime column

前端 未结 4 1522
独厮守ぢ
独厮守ぢ 2021-02-18 23:59

I should first mention that I\'m using SqlAlchemy through Flask-SqlAlchemy. I don\'t believe this affects the issue but if it does, please let me know.

Here is the relev

4条回答
  •  执笔经年
    2021-02-19 00:31

    last_updated = db.Column(db.DateTime, default=db.func.current_timestamp())
    

    I think this will work

提交回复
热议问题