On 5/1/15 2:33 PM, Rit Li wrote:
I have this snippet:
session.query(User).filter_by(foo=bar).order_by('uid desc').first()
I want to write it like this:
session.query(User).filter_by(foo=bar).latest()
`session` is already created at this point with the default Query object.
Is there a way to add the "latest()" method?
you can subclass sqlalchemy.orm.query.Query directly, and set it on your
session as sessionmaker(query_cls=MyQuery).
--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.