On Thu, Feb 25, 2016 at 12:01 PM, Piotr Dobrogost < p...@2016.groups.google.dobrogost.net> wrote:
> On Thursday, February 25, 2016 at 11:10:36 AM UTC+1, Simon King wrote >> >> >> I can't think of a way you could do this with objects you've already >> loaded into memory. Perhaps you could use Query.update to issue the >> appropriate SQL directly to the database? >> >> >> http://docs.sqlalchemy.org/en/rel_1_0/orm/query.html#sqlalchemy.orm.query.Query.update >> > > Thanks for your reply. > My reasoning is that if it's possible for one object (and it is) it should > be possible for multiple objects as well. > It seems to use Query.update I would need to filter/select related objects > (those accessible through association proxy) directly and this is > inconvenient as I would like to treat them as part of the primary objects > and be able to filter/select them for update "through" primary objects by > means of association proxy. > Maybe I'm not understanding your question properly. The return value from query.all() is a plain python list. You're asking for it to return a different kind of object, that wraps the underlying list and allows you to specify arbitrary operations that should be applied to each object in that list? I guess I could imagine a complicated class that might support something like that, but I don't think it exists at the moment, and it would seem like a lot of work just to avoid a simple loop... Simon -- 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.