Yeah I thought of that. I find it awkward because you have to think of 
using threadlocal objects, etc. I would have liked it better if sqlachemy 
exposed an api for that. But if that's not the case I'll do that.

Le jeudi 21 juillet 2016 17:56:45 UTC+2, Jonathan Vanasco a écrit :
>
> I do this often.
>
> All you need to do it stash the object into something that is in the scope 
> you wish the object to survive.  An array or dict works perfectly:
>
> stashed = []
>
>
> def f(s):
>  ...
>  parents = s.query(Parent).all() # load all parents objects in identity 
> map
>  stashed.append(parents)
>
>
> In the case of web programming, I stash loaded objects onto the `request` 
> object.
>

-- 
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.

Reply via email to