Querying with function on Flask-SQLAlchemy model gives BaseQuery object is not callable error
Model.query
is a shortcut to db.session.query(Model)
, it's not callable. If you're not querying a model, continue to use db.session.query(...)
as you would with regular SQLAlchemy.
db.session.query(db.func.sum(Services.price)).filter(
Services.dateAdd.between(start, end)
)