What is the right way to use .order_by() to order by the values returned
by a model object property? My model object is like this:
class Project(DeclarativeBase):
__tablename__ = 'project'
id = Column(Integer, primary_key=True)
...
@property
def remainderDue(self):
return self.totalDue - float(self.totalPaid)
The query I'm trying to run is:
projects =
DBSession.query(model.Project).order_by(desc(model.Project.remainderDue))
This returns the following error:
Module sqlalchemy.sql.expression:1279 in _literal_as_text
ArgumentError: SQL expression object or string expected.
Tim
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.