The question is very old, the answer here is for flask 2.x and flask-sqlalchemy 3.0.x
db.session.query is now called legacy query interface. they ask you to instead use db.session.execute
if you are following miguel grinbergs mega flask tutorial and your code is looking something like this:
orders = Order.query.filter_by(supplier_id=company_id, status="Sent").all()
the way to add an or in the where would be something like this:
from sqlalchemy import or_ orders = db.session.execute( db.select(Order) .where(Order.supplier_id == company_id) .where(or_(Order.status == "Sent", Order.status == "Accepted")) ).scalars()
here db is the flask_sqlalchemy.SQLAlchemy instance. Order is a db.Model derived class.
https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/queries/
from flask_sqlalchemy import or_but that didn't work.