[sqlalchemy] possible bug in .get()

2014-02-28 Thread Jonathan Vanasco
If this behavior is a bug , I can build out a testcase. FWIW , I think it's a bug. class Foo : id = int primary key bar = relationship(bar) baz = relationship(baz) # hits the db a = session.query( Foo ).get(1) # doesn't hit the db b =

Re: [sqlalchemy] possible bug in .get()

2014-02-28 Thread Michael Bayer
On Feb 28, 2014, at 12:09 PM, Jonathan Vanasco jonat...@findmeon.com wrote: If this behavior is a bug , I can build out a testcase. FWIW , I think it's a bug. class Foo : id = int primary key bar = relationship(bar) baz = relationship(baz) #

Re: [sqlalchemy] possible bug in .get()

2014-02-28 Thread Jonathan Vanasco
On Friday, February 28, 2014 12:41:46 PM UTC-5, Michael Bayer wrote: nope. get() means, “the SELECT may not happen”. eager loads are always secondary to the fact that the row is being loaded. if you want to definitely load the row, say filter_by(id…).first(). Poking at the source

Re: [sqlalchemy] possible bug in .get()

2014-02-28 Thread Michael Bayer
On Feb 28, 2014, at 2:12 PM, Jonathan Vanasco jonat...@findmeon.com wrote: On Friday, February 28, 2014 12:41:46 PM UTC-5, Michael Bayer wrote: nope. get() means, “the SELECT may not happen”. eager loads are always secondary to the fact that the row is being loaded. if you want to

Re: [sqlalchemy] possible bug in .get()

2014-02-28 Thread Jonathan Vanasco
On Friday, February 28, 2014 2:33:11 PM UTC-5, Michael Bayer wrote: OK well it has to emit the SELECT for the primary row, but yes populate_existing will overwrite, so really, just any equivalent of query(User).filter_by(primary key).first() is really all you need here…we used to have a