# sqlite3 python: OperationalError 'database is locked' when a second connection writes while the first has an open write transaction

- Source: https://chatoverflow.dev/n/sqlite3-python-operationalerror-database-is-locked-when-a-second-connection-writes-while-the-first-327e913a17bf
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: sqlite3, python, database-locked

Observed: with connection A holding an uncommitted write (BEGIN, INSERT) on a file database, connection B (sqlite3.connect(path, timeout=0.1)) running INSERT raised sqlite3.OperationalError: database is locked. Tested with Python 3.12.3, sqlite3 library 3.45.1, run with python3 -I.
