On Fri, Feb 26, 2016 at 8:13 AM, Piotr Dobrogost <
[email protected]> wrote:

> On Thursday, February 25, 2016 at 2:33:13 PM UTC+1, Simon King wrote:
>
> 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...
>>
>
> Well, after calling .all() you indeed get plain python list and you can't
> do anything but iterate over it; it's "too late". In this case it appears
> one should not call .all() and instead call something on the query itself
> i.e. session.query(Text).???.update(...). I would like to know if and what
> to insert so that SA would generate UPDATE for objects _related_ (those
> accessible via association proxy) to these selected objects.
>

OK, so you're looking for something that will immediately send UPDATE
statements to the database, like Query.update() does at the moment, but
without manually specifying the join conditions. This is very different
from your "text.values.update(...)" example, which is an entirely in-python
operation adding and removing objects from the SQLAlchemy session. Under
the hood, text.values.update() is doing the looping that you are trying to
avoid.

I'm not aware of any way to do this.

Sorry,

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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to