How to enable WAL mode for SQLite #1394
Replies: 1 comment
-
Thanks! :) It looks like the https://sqlite.org/pragma.html#pragma_journal_mode If you look at the codebase for I think the only solution for now is to override those areas of # piccolo_conf.py
from piccolo.engine.sqlite import SQLiteEngine
class CustomSQLiteEngine(SQLiteEngine):
async def get_connection(self) -> Connection:
connection = await super().get_connection()
await connection.execute("PRAGMA journal_mode = WAL")
return connection
DB = CustomSQLiteEngine(path='project.sqlite')A better solution would be to modify |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there
First off, love the work you all have put into Piccolo, the development experience so far has been wonderful and I appreciate all the time and care that has gone into its design and implementation.
I saw this post #1247 (comment) but didnt see any direct WAL instructions, so thought I would create a focused question here.
I really would like to use SQLite with WAL mode enabled.
Ideally I would want to set it when I instatiate the engine, something like
but there isn;t such an argument.
I tried various things like
and then calling this function in the main start up, but couldn't get it working.
I did find a PRAGMA for foreign keys in the codebase so I think it is possible, I just seem to not be able to find it.
How could I go about enabling WAL mode whenever I create my database ?
Many thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions