Mike, Would you be interested in a pull request to add a Query and/or Session option for this? My use case right now is putting the query in a registry so other callables down the line can refine the search criteria, but I may well not being alone in thinking that: query = self.session.query(Club) query.filter(Club.name.ilike(club)) query.order_by('name') possible = query.all() ...is easier to read than: possible = self.session.query(Club)\ .filter(Club.name.ilike(club))\ .order_by('name')\ .all()cheers, Chris On 28/12/2015 15:22, Mike Bayer wrote:
not through the current API, no. you'd need to write some modifier to the @generative decorator and basically tinker with things to make it do that. On 12/28/2015 06:18 AM, Chris Withers wrote:Hi All, Is there anything I can do to make Query instance non-generative? query = session.query(Foo) query.filter(Foo.x==1) ...and have the query actually be modified rather than returning a new query with the clause added? cheers, Chris -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. |
- [sqlalchemy] in-place modification of queries? Chris Withers
- [sqlalchemy] Re: in-place modification of queries? Lloyd Kvam
- Re: [sqlalchemy] in-place modification of queries? Mike Bayer
- Re: [sqlalchemy] in-place modification of queries? Chris Withers