ProgrammingError: SQLite objects created in a thread can only be used in that same thread

后端 未结 6 408
挽巷
挽巷 2020-12-01 04:58

i\'m fairly new to programming. I\'ve tried MySQL before, but now it\'s my first time using SQLite in a python flask website. So maybe I\'m using MySQL syntax instead o

6条回答
  •  北海茫月
    2020-12-01 05:39

    I had the same problem and I fixed it by closing my connection after every call:

    results = session.query(something, something).all()
    session.close()
    

提交回复
热议问题