Re: [sqlalchemy] eager loading relationships after an initial query?

2017-04-25 Thread Jonathan Vanasco
On Tuesday, April 25, 2017 at 5:50:48 AM UTC-4, Simon King wrote: > > def reload(instance, *options): > session = saorm.object_session(instance) > # TODO: make this generic rather than assuming presence of 'id' column > q = (session.query(type(instance)) >

Re: [sqlalchemy] eager loading relationships after an initial query?

2017-04-25 Thread Simon King
On Mon, Apr 24, 2017 at 10:26 PM, Jonathan Vanasco wrote: > > On Monday, April 24, 2017 at 4:28:22 PM UTC-4, Mike Bayer wrote: >> >> yeah just load the object again w/ the eagerloads option you want. > > > > Thanks. I was hoping there was a way to just say

Re: [sqlalchemy] eager loading relationships after an initial query?

2017-04-24 Thread Jonathan Vanasco
On Monday, April 24, 2017 at 4:28:22 PM UTC-4, Mike Bayer wrote: > > yeah just load the object again w/ the eagerloads option you want. > Thanks. I was hoping there was a way to just say `Obj.load('foo')` ? I'll just untangle the code and load the relationship in the first place. At this

Re: [sqlalchemy] eager loading relationships after an initial query?

2017-04-24 Thread mike bayer
yeah just load the object again w/ the eagerloads option you want. On 04/24/2017 04:12 PM, Jonathan Vanasco wrote: [I couldn't find any docs on this, and my luck with the list archives only showed some potential work for this in 2008.] Is it currently possible to eager-load a ORM relationship

[sqlalchemy] eager loading relationships after an initial query?

2017-04-24 Thread Jonathan Vanasco
[I couldn't find any docs on this, and my luck with the list archives only showed some potential work for this in 2008.] Is it currently possible to eager-load a ORM relationship after a query? For example, I have loaded an instance of `Foo`, but I did not do an eager load on `Foo.bars` and