Re: [sqlalchemy] Measure time to checkout a connection from the pool

2014-02-20 Thread Shahaf Abileah
Thanks Michael. For what it's worth, I ended up doing this: # thread local storage tls = threading.local() # Add custom code to measure the time we spend on the current thread waiting # to get a DB connection from the pool. We do this by defining a decorator # and monkey-patching the relevant

Re: [sqlalchemy] filter vs get question

2014-02-20 Thread Claudio Freire
On Thu, Feb 20, 2014 at 5:22 PM, Jonathan Vanasco jonat...@findmeon.com wrote: this seems to work, but I want to just make sure this is the intended behavior. a = dbSession.query( Something ).filter( Something.primary_key == 1 ).first() b = dbSession.query( Something ).get( 1 ) c =

Re: [sqlalchemy] filter vs get question

2014-02-20 Thread Jonathan Vanasco
that's fine. this is for a webapp where we have in a single request : begin; user = .filter().first() DO LOTS OF STUFF, all over the place DO EVEN MORE STUFF , in more places user = .get(user_id) commit; if this behavior is intended, then we can just rely on it for now.

Re: [sqlalchemy] filter vs get question

2014-02-20 Thread Michael Bayer
On Feb 20, 2014, at 3:22 PM, Jonathan Vanasco jonat...@findmeon.com wrote: this seems to work, but I want to just make sure this is the intended behavior. a = dbSession.query( Something ).filter( Something.primary_key == 1 ).first() b = dbSession.query( Something ).get( 1 ) c