[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-10 Thread Michael Bayer
just deal with the session, and bind it to an engine. saying "engine.connect()" does nothing down there since you arent holding onto anything. the engine itself is stateless with regards to connections (unless you use the threadlocal strategywhich you shouldnt). On Apr 10, 2007, at

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-10 Thread Koen Bok
> the elegant way would be to not worry about the thread scope of a > connection and just use connection pooling normally. pull out a > connection when needed, close it when complete (which is really just > a return to the connection pool). keep the scope of those two > operations local

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-09 Thread Michael Bayer
On Apr 9, 2007, at 11:54 AM, David Anderson wrote: > > On 4/9/07, Michael Bayer <[EMAIL PROTECTED]> wrote: >>> I tried to build this already but I cannot figure out how to assign >>> the shared connection to a thread. I always get 'No connection >>> defined'. >> >> if youre on py2.4 check out th

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-09 Thread David Anderson
On 4/9/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > I tried to build this already but I cannot figure out how to assign > > the shared connection to a thread. I always get 'No connection > > defined'. > > if youre on py2.4 check out threading.local(). Just to be clear here, as I'm also having

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-09 Thread Michael Bayer
On Apr 9, 2007, at 5:18 AM, Koen Bok wrote: > > We are building a GUI app, and we were thinking about wrapping > session.flush() in a thread with a timer that detects a timeout. That > way we would have better performace and we can generate warnings if > the connection goes down. Do you guys thi

[sqlalchemy] Re: Putting Session.flush in a seperate thread

2007-04-09 Thread Arun Kumar PG
may be a threadlocal strategy. On 4/9/07, Koen Bok <[EMAIL PROTECTED]> wrote: > > > We are building a GUI app, and we were thinking about wrapping > session.flush() in a thread with a timer that detects a timeout. That > way we would have better performace and we can generate warnings if > the con