Python sqlite3 and concurrency

前端 未结 14 903
南笙
南笙 2020-11-30 18:00

I have a Python program that uses the \"threading\" module. Once every second, my program starts a new thread that fetches some data from the web, and stores this data to my

14条回答
  •  [愿得一人]
    2020-11-30 18:33

    Contrary to popular belief, newer versions of sqlite3 do support access from multiple threads.

    This can be enabled via optional keyword argument check_same_thread:

    sqlite.connect(":memory:", check_same_thread=False)
    

提交回复
热议问题