[sqlalchemy] overriding lazy loading?

2013-09-12 Thread Seth P
Is it possible to override the default loading strategy of a relationship 
at run-time? For example, I have a relationship that I almost always want 
to load with lazy='subquery' -- and so I set that as the default loading 
strategy in the relationship definition  -- but in one instance, when I 
know I won't be accessing the related objects, I'd much rather load with 
lazy='select' (so as not to load the related objects). Is this possible?

Thanks,

Seth

-- 
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/groups/opt_out.


Re: [sqlalchemy] overriding lazy loading?

2013-09-12 Thread Michael Bayer
have you looked at http://docs.sqlalchemy.org/en/rel_0_8/orm/loading.html ?


On Sep 12, 2013, at 9:18 PM, Seth P spadow...@gmail.com wrote:

 Is it possible to override the default loading strategy of a relationship at 
 run-time? For example, I have a relationship that I almost always want to 
 load with lazy='subquery' -- and so I set that as the default loading 
 strategy in the relationship definition  -- but in one instance, when I know 
 I won't be accessing the related objects, I'd much rather load with 
 lazy='select' (so as not to load the related objects). Is this possible?
 
 Thanks,
 
 Seth
 
 -- 
 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/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] overriding lazy loading?

2013-09-12 Thread Seth P
D'oh! I did, though for some reason it didn't occur to me that I could 
specify .override(lazyload('points')) to override the relationship's 
default lazy='subquery'. Works like a charm. Thank you.

-- 
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/groups/opt_out.