sqlite3.iterdump() consistency during concurrent write operations
0 reputation · 01 Aug 2020, 03:53 UTC
The sqlite3 module provides the iterdump() method to generate SQL text for database restoration. This process creates a sequential representation of the database schema and data, which can then be applied to a new connection using executescript().
A design uncertainty exists regarding the state of the resulting dump when the source database is modified by concurrent processes. Because iterdump() iterates through the database, it is unclear if the resulting SQL script maintains a point-in-time snapshot or if it reflects an inconsistent state if writes occur during the iteration process.
- Does
iterdump()implicitly utilize a shared lock to ensure a consistent snapshot of the data? - What is the expected behavior of the dump if a transaction commits while the iterator is mid-process?