Adam M Peacock wrote: > Is there a difference in the SQL executed when using lazy vs eager > loading? Specifically, if I use eager loading will everything be > queried at once with a more efficient join, or will it still use the > lazy style (as far as I understand it) of generating a ton extra > queries as it loads each relation separately? If it is the former, > more efficient case (an eager relation uses a join) is it possible to
> override the loader type at query time, such as being lazy by default > but being nice to the database when I know I'm going to need all the > data from the relation (especially if I'm calling a couple thousand > rows for a report)? Eager loads are performed using a join, so only a single query is issued. You can change the eager/lazy behaviour at query time by using the 'options' method on the query object. See <http://www.sqlalchemy.org/docs/datamapping.myt#datamapping_selectrelati ons_eagerload> and <http://www.sqlalchemy.org/docs/datamapping.myt#datamapping_selectrelati ons_options> for more. Hope that helps, Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
