Kent wrote: > I should have mentioned that even when I was using lazyload() I was > getting the same problem, but I think I corrected my problem with > this: > > > o=DBSession.query(Order).options(lazyload(Order.orderdetails,OrderDetail.product)).get(u'SALE35425') > > I think I understand better now: is it correct that you need to > "chain" the relations, but calling lazyload() is really only marking a > single relation as lazy. For example, in the above call, I need > 'Order.orderdetails' in order to *reach* 'OrderDetail.product', but it > is *only* 'OrderDetail.product' that is being marked as lazy. > 'Order.orderdetails' lazy status is unaffected, even though it is in > the call to lazyload(). > > Is that accurate?
it is and you can get a shorthand if you use a string, I believe the syntax is lazyload("orderdetails.product"). > > > > On Mar 17, 4:05 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: >> Kent wrote: >> > Does defer only relate to ColumnProperty while lazyload relates to >> > RelationProperty? >> >> > Apparently I should be using lazyload() instead of defer()? >> >> that is the case at the moment yes. >> >> But I can see that perhaps defer() should be dual-purposed here. the >> "eager/lazy" terminology used to be much more prominent in our >> documentation so its only recently that this kind of thing had a chance >> of >> getting confusing. >> >> >> >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "sqlalchemy" group. >> > To post to this group, send email to sqlalch...@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. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@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. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.