sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "DROP": syntax error

这就是flask 对应 sqlite的一个坑

解决方式

1.修改migrations/evn.py中的方法, 添加 render_as_batch=True

在这里插入图片描述

2、删除version下面的各种东西,

3、重新执行python manage.py db init    //  migrate  //  upgrade

4、

(venv) D:\zz\PycharmProjects\flask_test2>python manage.py db init
Error: Directory migrations already exists and is not empty

(venv) D:\zz\PycharmProjects\flask_test2>python manage.py db migrate
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.autogenerate.compare] Detected removed column 'users.password'
Generating D:\zz\PycharmProjects\flask_test2\migrations\versions\eae21a12bdae_.py ...  done

(venv) D:\zz\PycharmProjects\flask_test2>python manage.py db upgrade
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> eae21a12bdae, empty message

 

你可能感兴趣的:(python)