在做flask项目中的版本回退,时,出现了AttributeError: ‘NoneType’ object has no attribute ‘lower’
执行python 文件名.py db downgrade 版本号,后报错了,主要的报错内容如下:
INFO [alembic.runtime.migration] Context impl MySQLImpl.

INFO [alembic.runtime.migration] Will assume non-transactional DDL.

INFO [alembic.runtime.migration] Running downgrade 67e517bde18c ->bc447eaaaab1, test2
lc_value = value.lower()

AttributeError:’NoneType’ object has no attribute ‘lower’

解决办法:
在需要迁移的版本中, 有一个downgrade函数,其中有op.drop_constrain(None, ‘其他字段名’)
把None改成自己更改的字段名即可解决
Flask回滚时出现AttributeError: 'NoneType' object has no attribute 'lower'

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-25
  • 2021-06-13
  • 2022-01-08
  • 2021-11-20
  • 2021-07-31
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案