Flask SQLAlchemy query.all() using SQLite



我正在关注这个教程微博来实现一个web应用程序。我陷入了";播放时间";段落当我在python控制台users = User.query.all()中运行此命令时

我的编辑器Pycharm返回此错误

sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 12404 and this is thread id 7880.
[SQL: SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash 
FROM user]
[parameters: [immutabledict({})]]
(Background on this error at: http://sqlalche.me/e/13/f405)

我该如何解决这个问题?

只需重新加载IDE。这与线程有关,但重新加载解决了问题。我知道已经很晚了,但也许这会对某人有所帮助。

最新更新