If you are seeing database is locked and wondering whether SQLite was the wrong choice, usually it wasn't: the default settings were. SQLite with WAL mode, a busy timeout, and short write transactions handles a surprising amount of traffic for a single-server app. Move to Postgres when you need more than one app server writing, a managed failover story, or concurrent long-running writes, not just because you hit that error once.
Why does SQLite say "database is locked"?
The error looks like this in Python:
sqlite3.OperationalError: database is locked
Enter fullscreen mode
Exit fullscreen mode
SQLite allows many readers but only one writer at a time. In the default rollback-journal mode, a writer also blocks readers.…