This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dave Sawyer
Recipients Dave Sawyer, berker.peksag, docs@python, orsenthil, takluyver
Date 2016-06-03.00:43:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Hi Thomas and Senthil, for the serialized setting I mentioned earlier "The serialized mode is default on both Mac and Windows so we can probably skip validating that. I did like mentioning the user needs to serialize the writes. They could use one thread for writing only or use locking. So, I just said to serialize."

to go into more detail, when serialize is set you don't need to worry that using multiple threads will WRECK your database. But, you still need to make sure your own writes get serialized or you will mix transactions together. Each connection only has one transaction in progress so if you share that connection between threads... watch out for your writes. Now if only one thread in your application writes and the other threads read you have no serialization issues to worry about. If two threads make updates without a threading.Lock than you can get 1.5 changes committed (and perhaps 0.5 later or if that had an error you might rollback that 0.5 of a transaction). You could also get the first thread to commit both changes and when the later thread calls commit get an error that is "no transaction in progress."

I thought "serialize" neatly encapsulated the two most common strategies here for shared connections - either a dedicated writer thread or using a python lock around your transactions. As Thomas points out you can also opt to give each thread its own connection... but then you don't need the check_same_thread parameter set to False as you are not sharing the connection.
Date User Action Args
2016-06-03 00:43:05Dave Sawyersetrecipients: + Dave Sawyer, orsenthil, docs@python, takluyver, berker.peksag
2016-06-03 00:43:05Dave Sawyersetmessageid: <>
2016-06-03 00:43:05Dave Sawyerlinkissue27113 messages
2016-06-03 00:43:04Dave Sawyercreate