Sometimes, we want to fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3
In this article, we’ll look at how to fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3.
How to fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3?
To fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3, we can call sqlite3.connect
with check_same_thread
set to False
.
For instance, we wrikte
conn = sqlite3.connect('your.db', check_same_thread=False)
to call sqlite3.connect
with the check_same_thread
set to False
so that SQLite objects created in any thread can be used in any other thread.
Conclusion
To fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3, we can call sqlite3.connect
with check_same_thread
set to False
.
3 replies on “How to fix ProgrammingError: SQLite objects created in a thread can only be used in that same thread with Python SQLite3?”
Thanks for this post🙌 , it has been useful. I was looking for this solution, and this website has been the unique source of correct information.
Very useful information, great thanks for you, I finally found the solution!
it is not a real fix but way to ignore it 😉