This commit is contained in:
Waylon Walker 2023-06-10 19:01:14 -05:00
parent d5abc2ec96
commit 010709a500
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
2 changed files with 41 additions and 7 deletions

View file

@ -65,14 +65,15 @@ class HeroRead(HeroBase):
# with config.database.session as session:
if session is None:
session = get_config().database.session
statement = select(Hero)
if where != "None" and where is not None:
from sqlmodel import text
engine = get_config().database.engine
with Session(engine) as session:
statement = select(Hero)
if where != "None" and where is not None:
from sqlmodel import text
statement = statement.where(text(where))
statement = statement.offset(offset).limit(limit)
heroes = session.exec(statement).all()
statement = statement.where(text(where))
statement = statement.offset(offset).limit(limit)
heroes = session.exec(statement).all()
return heroes