Python 数据库拒绝类枚举中的新值

Python 数据库拒绝类枚举中的新值,python,mysql,enums,sqlalchemy,Python,Mysql,Enums,Sqlalchemy,我的models.py文件中有这个类: class DepartmentCategory(Enum): """The various categories of departments""" committee = 'Committee' subcommittee = 'Subcommittee' 在我的表单的selectfield中使用。所有这些都可以正常工作,但当我向Enum类添加新值时,例如: class DepartmentCategory(Enum):

我的models.py文件中有这个类:

class DepartmentCategory(Enum):
    """The various categories of departments"""
    committee = 'Committee'
    subcommittee = 'Subcommittee'
在我的表单的selectfield中使用。所有这些都可以正常工作,但当我向Enum类添加新值时,例如:

class DepartmentCategory(Enum):
    """The various categories of departments"""
    general = 'General'
    committee = 'Committee'
    subcommittee = 'Subcommittee'

保存新值时,数据库将失败,并且终端和浏览器中都不会显示任何错误。我已经多次迁移(FlackDB迁移)和升级(FlackDB升级)我的数据库,但问题并没有解决。请提供帮助。

您需要迁移数据库定义,例如使用尝试安装
enum34
。在Python3-x上使用
enum
时,我发现
flask\u migrate
无法检测到更改。然后我看到了这个问题中的评论

pip安装枚举34

注意:继续使用
import enum
import enum34
是错误的。

如果您的意思是运行flask db migrate,然后运行flask db upgrade,我已经这么做了。我用的是烧瓶。