forked from platypush/platypush
Wrap the PRAGMA
statement in sqlalchemy.text
.
SQLAlchemy 2 no longer supports raw strings passed to `.execute()` methods.
This commit is contained in:
parent
440d70d9cf
commit
dd60b8924d
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@ from threading import Thread
|
|||
from time import time
|
||||
from typing import Optional, Any, Collection, Mapping
|
||||
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy import or_, text
|
||||
from sqlalchemy.orm import make_transient, Session
|
||||
|
||||
from platypush.config import Config
|
||||
|
@ -198,7 +198,7 @@ class EntitiesPlugin(Plugin):
|
|||
if str(session.connection().engine.url).startswith('sqlite://'):
|
||||
# SQLite requires foreign_keys to be explicitly enabled
|
||||
# in order to proper manage cascade deletions
|
||||
session.execute('PRAGMA foreign_keys = ON')
|
||||
session.execute(text('PRAGMA foreign_keys = ON'))
|
||||
|
||||
entities: Collection[Entity] = (
|
||||
session.query(Entity).filter(Entity.id.in_(entities)).all()
|
||||
|
|
Loading…
Reference in a new issue