Fix SQLAlchemy 2.0 compatibility
- Wrap PRAGMA statement with text() for SQLAlchemy 2.0 - Fixes ObjectNotExecutableError on database initialization
This commit is contained in:
@@ -10,6 +10,7 @@ from sqlalchemy import (
|
||||
DateTime,
|
||||
Index,
|
||||
CheckConstraint,
|
||||
text,
|
||||
)
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
@@ -101,7 +102,7 @@ def init_db():
|
||||
# Enable WAL mode for SQLite
|
||||
if "sqlite" in DATABASE_URL:
|
||||
with engine.connect() as conn:
|
||||
conn.execute("PRAGMA journal_mode=WAL")
|
||||
conn.execute(text("PRAGMA journal_mode=WAL"))
|
||||
conn.commit()
|
||||
|
||||
# Initialize statistics table with single row
|
||||
|
||||
Reference in New Issue
Block a user