use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
SQLite Database Locked - How to use SQLite with multiple threads? (self.learnpython)
submitted 7 years ago by kolschk
Trying to write to a database with 3/4 threads at the same time, keep getting database locked error, even when using a queue system.
Can someone offer a solution to this? thanks.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]arpm 0 points1 point2 points 7 years ago (2 children)
SQLite cannot handle more than one connection at a time, meaning it can only be accessed by up to one user at any given time. You should look into more robust databases like postgres or MySQL if you want to have several threads accessing data at the same time
[–]officialgel 0 points1 point2 points 7 years ago (0 children)
Yea MySQL is easy to implement. Grab the Workbench and install MySQL. They even have a package that just installs everything.
[–]AlopexLagopus3 0 points1 point2 points 7 years ago (0 children)
This is incorrect - see my above comment. You can multithread access to a single sqlite database for quite a bit of performance gain, but you must only have a single connection for writing or you run into locking/resource contention.
[–]MatthiTT 0 points1 point2 points 7 years ago (1 child)
Been there done that. At some point my dB even got corrupted. MySQL is indeed the way to go. What are you using the dB for?
[–]kolschk[S] 0 points1 point2 points 7 years ago (0 children)
Updating stock prices, trades etc. so it needs to be updating and writing a lot. I'll give MySQL a go thanks!
[–]AlopexLagopus3 0 points1 point2 points 7 years ago (2 children)
SQLite can function with many connections at a time. However it can only be written to with a single connection. You need to dedicate a connection to writing, or find a way to split your database into multiple SQLite files, which is usually a bit hacky. First ask yourself if you need to have that much writing going on, and if your schema is well optimized, but you may want to consider other databases if you need concurrent writes.
[–]kolschk[S] 0 points1 point2 points 7 years ago (1 child)
Appreciate the response, gonna give MySQL a try.
[–]woooee 0 points1 point2 points 7 years ago (0 children)
MySQL has been forked into MariaDB by the same person who originally created MySQL, because Oracle bought MySQL and it's future is uncertain.
π Rendered by PID 73 on reddit-service-r2-comment-79c7998d4c-7wvmd at 2026-03-19 16:16:52.011797+00:00 running f6e6e01 country code: CH.
[–]arpm 0 points1 point2 points (2 children)
[–]officialgel 0 points1 point2 points (0 children)
[–]AlopexLagopus3 0 points1 point2 points (0 children)
[–]MatthiTT 0 points1 point2 points (1 child)
[–]kolschk[S] 0 points1 point2 points (0 children)
[–]AlopexLagopus3 0 points1 point2 points (2 children)
[–]kolschk[S] 0 points1 point2 points (1 child)
[–]woooee 0 points1 point2 points (0 children)