flask 学习错误总结 (sqlite3.OperationalError) no such table / no such column
来源:互联网 发布:arm linux gcc 4.4.3 编辑:程序博客网 时间:2024/06/05 13:28
在学习flask狗书的时候在第七章的时候将hello.py分解成为程序结构的时候 出现这个
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.username AS users_username, users.role_id AS users_role_id \nFROM users \nWHERE users.username = ?\n LIMIT ? OFFSET ?']
在谷歌了很久以后发现了 作者的回答 you probably missed the fact that after the restructure in chapter 7 the name of the database has changed. Post chapter 7 the application has multiple configurations, and each configuration uses a different database. So you are probably using an empty database that has no tables. If you run manage.py db upgrade
you should get the tables added to your database. 确实是因为忘记了红色标记的这一步骤
然后运行了此步骤过后 程序正常
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: users.confirmed [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash AS users_password_hash, users.confirmed AS users_confirmed \nFROM users \nWHERE users.email = ?\n LIMIT ? OFFSET ?'] [parameters: ('john@example.com', 1, 0)]
出现此错误是因为在修改了数据库的数据后没有使用 .py db migrate 根据作者的回答可以很清晰的看出每次该怎么做
It goes like this:
- When you begin your project, use
db init
, followed bydb migrate
, followed bydb upgrade
. - When you make changes to your database, use
db migrate
, followed bydb upgrade
. - When you install your code on a new machine, or need to recreate the database from scratch, use
db upgrade
.
- flask 学习错误总结 (sqlite3.OperationalError) no such table / no such column
- (sqlite3.OperationalError) no such table: users(关键词:Web开发/Flask/数据库/SQLite/bug)
- Django: OperationalError no such table
- Django: OperationalError / no such table
- (sqlite3.OperationalError) no such table- users [SQL- 'SELECT users.id AS users_id, users.email AS u
- Django排雷记——OperationalError: no such table: django_session
- (1) no such column
- Error: no such column
- Android搜索错误no such column
- sqlite no such table
- sqlite 报 no such table 错误
- django no such table: django_session 错误解决
- Django笔记 no such table: django_session错误
- django no such table: django_session 错误解决
- 使用flask-ASQLchemy时,Error:No such table
- SQLiteLog (1) no such Column:
- SQLiteLog (1) no such Column:
- SQLiteLog (1) no such Column
- python建网站之MySQL模块
- mybatis学习六之缓存
- 汇编语言-王爽-实验4
- crontab 定时任务
- js 常用数字计算表达式
- flask 学习错误总结 (sqlite3.OperationalError) no such table / no such column
- MyBatis中关于别名typeAliases的设置
- 遍历与复制数组
- 大数据早报:亚马逊最大风力发电站投入使用 MongoDB上市首日股价飙涨34%(10.21)
- 数据结构与算法(Java描述)-6、栈的基本概念以及顺序栈的实现
- 自己训练haar特征的adaboost分类器
- 写MyListview控件
- JAVA中转义字符
- Python数据类型一