def search(message):
data = cur1.execute(
"SELECT * FROM book WHERE name || ' ' || author_name || ' ' || author_lastname || ' ' || name || ' ' || author_lastname || ' ' || author_name || ' ' || author_name || ' ' || name || ' ' || author_lastname || ' ' || author_name || ' ' || author_lastname || ' ' || name || ' ' || author_lastname || ' ' || name || ' ' || author_name || ' ' || author_lastname || ' ' || author_name || ' ' || name ILIKE '%' || ? || '%'",
('%' + message + '%',)).fetchall()
con1.commit()
return data
Пытаюсь сделать такое:
async def search(message):
async with async_session() as session:
stmt = select(Book).where(or_(Book.name.ilike(":message")), (Book.author_name.ilike(":message"), (Book.author_lastname.ilike(":message"))))
sss = await session.execute(stmt, {"message": message})
await session.commit()
return sss.fetchall()
Выдает ошибку:
sqlalchemy.exc.ArgumentError: SQL expression for WHERE/HAVING role expected, got (, ).