Question Details

No question body available.

Tags

python sqlite

Answers (1)

Accepted Answer Available
Accepted Answer
January 4, 2026 Score: 1 Rep: 20,056 Quality: High Completeness: 70%

Based on the docs, which say that the setting is persistent, you could just write the setting in a first round, either in Python or the sqlite program https://www.sqlite.org/wal.html#:~:text=3%2E3%2E%20Persistence%20of%20WAL%20mode,-Unlike

db = sqlite3.connect(dbpath)
db.execute('PRAGMA journalmode = WAL')
db.close()

db = sqlite3.connect(dbpath, autocommit=False) db.execute('PRAGMA journalmode = WAL') # now succeeds as already set ...

Assuming you always want the setting, you might even make this a somewhat-ugly dance into a wrapper