File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3- import sqlite3
4-
53from app .core .config import settings
64from sqlalchemy import event
75from sqlalchemy .engine import make_url
2119
2220 @event .listens_for (engine .sync_engine , "connect" )
2321 def _enable_sqlite_pragmas (dbapi_connection , _ ):
24- if isinstance (dbapi_connection , sqlite3 .Connection ):
25- cursor = dbapi_connection .cursor ()
26- # Always enable FK cascades
27- cursor .execute ("PRAGMA foreign_keys=ON" )
28- # If file-based (not :memory:), WAL improves concurrency
29- if url .database and url .database not in (":memory:" , "" ):
30- cursor .execute ("PRAGMA journal_mode=WAL" )
31- cursor .execute ("PRAGMA synchronous=NORMAL" )
32- cursor .close ()
22+ cursor = dbapi_connection .cursor ()
23+ # Always enable FK cascades
24+ cursor .execute ("PRAGMA foreign_keys=ON" )
25+ # If file-based (not :memory:), WAL improves concurrency
26+ if url .database and url .database not in (":memory:" , "" ):
27+ cursor .execute ("PRAGMA journal_mode=WAL" )
28+ cursor .close ()
3329
3430
3531async_session = async_sessionmaker (
You can’t perform that action at this time.
0 commit comments