> session.refresh(user, ["title", "first_name", "last_name"]) 
>

This was the part that I was missing.  It's fairly readable and it does 
exactly what I'd need.
 

>
> also, if the columns you're actually using are along these lines, that is, 
> they aren't 10K text files, I'd strongly encourage you to do some actual 
> profiling to determine if all this complexity is necessary and not actually 
> hurting performance much more.    To pull over 3K of text over the wire in 
> a single result is probably a lot less overhead than to pull 1000K of text 
> in two or three queries. 
>

At this point I'm really just exploring the boundaries of the tool so that 
I can select a flexible design.  I still haven't quite found the sweet spot 
between what can/should be lazy and what cannot/shouldn't be lazy.  In the 
existing application (the non-ORM one) all of this is done with an 
abstracted form of direct SQL (kind of like SQLAlchemy core).  I'd like to 
convert some of those sections to use declarative objects instead, so the 
point of of this is to know that if I do go down that path then I could 
still optimize the columns if I needed to (read: after I profiled it and 
determined that it was necessary) without having to drop all the way down 
to SQLAlchemy core and then change things from passing objects around to 
passing keys in some circumstances.  Although it's very likely that you are 
correct and that the complexity induced from using this kind of system may 
outweigh the over-the-wire savings -- I guess we'll see when I get there.


well this is what the "group" feature does, if any columns in the group are 
> touched, the whole group is loaded.  My advice would be to do some 
> profiling, come up with groups that are tailored close enough to the groups 
> of attributes that tend to be called together, and to not overthink it. 
>

I will certainly look into this some more, since there are certainly groups 
of columns that can be naturally grouped.  Plus I imagine that 
session.refresh() would load the entire group if an attribute from a group 
was passed to it.  So that could be an interesting way to chunk it.


Thanks for responding with such a great post.  Its certainly helped me 
think through the issues from different angle.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/zQNUzzPhzFAJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to