Defining SQLAlchemy enum column with Python enum raises “ValueError: not a valid enum”

喜夏-厌秋 提交于 2019-12-02 18:54:27
r-m-n

The column type should be sqlalchemy.types.Enum. You're using the Python Enum type again, which is valid for the value but not the column type.

class MyTable(db.Model):
    id = db.Column(db.Integer, primary_key = True)
    fruit_type = db.Column(db.Enum(FruitType))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!