From 8adeece5c3453541924c63f5658387317cea377e Mon Sep 17 00:00:00 2001 From: "felix.zoesch" Date: Mon, 15 Dec 2025 10:19:03 +0100 Subject: [PATCH] Fix SQLAlchemy 2.0 compatibility - Wrap PRAGMA statement with text() for SQLAlchemy 2.0 - Fixes ObjectNotExecutableError on database initialization --- backend/app/database.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/database.py b/backend/app/database.py index 7da448e..e18b807 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -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