classification
Title: sqlite3 docs do not explain check_same_thread
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: sqlite3 connect parameter "check_same_thread" not documented
View: 27113
Assigned To: docs@python Nosy List: BreamoreBoy, berker.peksag, docs@python, ghaering, r.david.murray, strcat, takluyver
Priority: normal Keywords:

Created on 2012-11-19 07:40 by strcat, last changed 2016-05-25 13:41 by berker.peksag. This issue is now closed.

Messages (5)
msg175946 - (view) Author: Daniel Micay (strcat) Date: 2012-11-19 07:40
The sqlite3 documentation now includes a Multithreading section explaining issues with older sqlite versions, but still doesn't directly cover disabling check_same_thread beyond listing it as a possible parameter.

As far as I can tell, reusing sqlite connections in different threads (such as from a pool) is safe, as long as no attempt is made to use them from multiple threads with no locking.
msg223245 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-16 18:22
@Daniel could you provide a patch for this?
msg223304 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-07-17 00:26
The module docs do mention "Older SQLite versions had issues with sharing connections between threads." Presumably that means that sharing the connection between threads is safe so long as you're not using 'older versions', but it would be nice to have some more clarity about how old those versions are.
msg223305 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-07-17 00:29
This page also looks relevant: sqlite can be compiled or used in three different threading modes. Presumably Python compiles/initialises it in the serialised mode, which makes it safe to use a connection from different threads.

http://www.sqlite.org/threadsafe.html
msg266353 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-05-25 13:41
Issue 27113 has a patch and more detailed description so I'm going to close this one as a 'duplicate'.

Thanks for the report!
History
Date User Action Args
2016-05-25 13:41:01berker.peksagsetstatus: open -> closed

superseder: sqlite3 connect parameter "check_same_thread" not documented

nosy: + berker.peksag
messages: + msg266353
resolution: duplicate
stage: needs patch -> resolved
2014-07-17 00:29:03takluyversetmessages: + msg223305
2014-07-17 00:26:27takluyversetmessages: + msg223304
2014-07-16 18:22:34BreamoreBoysetnosy: + BreamoreBoy
messages: + msg223245
2013-01-28 23:36:37takluyversetnosy: + takluyver
2013-01-10 15:20:31r.david.murraysetnosy: + r.david.murray
2012-11-23 17:18:16ezio.melottisetnosy: + ghaering
stage: needs patch

versions: + Python 3.2, Python 3.4
2012-11-19 07:40:51strcatcreate