Change SQLite config to avoid locking

This commit is contained in:
Théophile Diot 2023-09-04 15:52:08 +02:00
parent 07725356b6
commit 040d447145
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -166,6 +166,11 @@ class Database:
bind=self.__sql_engine, autoflush=False, expire_on_commit=False
)
self.suffix_rx = re_compile(r"_\d+$")
if sqlalchemy_string.startswith("sqlite"):
with self.__db_session() as session:
session.execute(text("PRAGMA journal_mode=WAL"))
session.commit()
def __del__(self) -> None:
"""Close the database"""