3 ms·
I did the exact same thing yesterday, couple of notes: If you subclass sqlite3.base.DatabaseWrapper, it will issue the required PRAGMAs defined by Django, wher
by kissgyorgy 2y ago
I did the exact same thing yesterday, couple of notes:
If you subclass sqlite3.base.DatabaseWrapper, it will issue the required PRAGMAs defined by Django, where foreign_keys = ON and legacy_alter_table = OFF.
I don't think synchronous = NORMAL worth it, as there is a tiny-tiny chance you will lose data. The relevant section from SQLite doc:
"A transaction committed in WAL mode with synchronous=NORMAL might roll back following a power loss or system crash."
IMMEDIATE mode might not be needed and your application might never get a database locked error, I would only use that when I see the first error.
You can read about mmap_size in depth here: https://oldmoe.blog/2024/02/03/turn-on-mmap-support-for-your-sqlite-connections/ https://oldmoe.blog/2024/02/03/turn-on-mmap-support-for-your...