I'm calling this "eagerloading" , but it's not the right term...

I have an object that is already loaded...

    user = dbSession.query( model.User ).filter_by( id = 1 ).first()

over time it's seen a handful of relationships grow...

    user = dbSession.query( model.User ).filter_by( id = 1 )\
                .options(\
                    joinedload('foo') ,
                    joinedload('foo.bar') ,
                    joinedload('biz') ,
                    joinedload('biz.bash') ,
                )\

profiling some code, I don't need to eagerload everything anymore.  

I'd like to try and select the least amount of data at first, then select 
more as needed.

i know for single-level items I can just hit the property as `User.foo` and 
for collections i can do  `list( User.foo )`

but are there good ways to handle relationships like `User.foo.bar` ?

My goal is to load all the data for the named relationships at once.  I 
don't want to iterate through rows or leave a db cursor open. 


-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to