Re: [sqlalchemy] Wired connection problem

2012-05-17 Thread Michael Bayer
On May 16, 2012, at 8:33 PM, limodou wrote: On Thu, May 17, 2012 at 8:03 AM, limodou limo...@gmail.com wrote: On Thu, May 17, 2012 at 7:46 AM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at 7:32 PM, limodou wrote: OK you need to use two different connections here,

Re: [sqlalchemy] Wired connection problem

2012-05-17 Thread limodou
On Thu, May 17, 2012 at 8:59 PM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at 8:33 PM, limodou wrote: On Thu, May 17, 2012 at 8:03 AM, limodou limo...@gmail.com wrote: On Thu, May 17, 2012 at 7:46 AM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread Michael Bayer
On May 15, 2012, at 8:13 PM, limodou wrote: Recently I found a wired problem in my application, something like this: I have a long time deamon program, it'll be an infinite loop, just like: engine = create_engine('...') conn = engine.connect() while True: for row in select:

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread limodou
On Wed, May 16, 2012 at 9:42 PM, Michael Bayer mike...@zzzcomputing.com wrote: On May 15, 2012, at 8:13 PM, limodou wrote: Recently I found a wired problem in my application, something like this: I have a long time deamon program, it'll be an infinite loop, just like: engine =

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread Michael Bayer
On May 16, 2012, at 11:11 AM, limodou wrote: Thank you for the detail explains. And I tried like this again: 1. if there are only select statements it will ok, and the select statements will fetch the new changed records. 2. select after update, if there is no record at some point, it'll

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread limodou
On Wed, May 16, 2012 at 11:27 PM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at 11:11 AM, limodou wrote: Thank you for the detail explains. And I tried like this again: 1. if there are only select statements it will ok,  and the select statements will fetch the new

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread Michael Bayer
On May 16, 2012, at 7:32 PM, limodou wrote: OK you need to use two different connections here, for the read from one connection, persist on another in a short transaction pattern. Again the with engine.begin() thing, which is new as of 0.7...6? makes this pretty succinct: while

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread limodou
On Thu, May 17, 2012 at 7:46 AM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at 7:32 PM, limodou wrote: OK you need to use two different connections here, for the read from one connection, persist on another in a short transaction pattern.  Again the with engine.begin()

Re: [sqlalchemy] Wired connection problem

2012-05-16 Thread limodou
On Thu, May 17, 2012 at 8:03 AM, limodou limo...@gmail.com wrote: On Thu, May 17, 2012 at 7:46 AM, Michael Bayer mike...@zzzcomputing.com wrote: On May 16, 2012, at 7:32 PM, limodou wrote: OK you need to use two different connections here, for the read from one connection, persist on

[sqlalchemy] Wired connection problem

2012-05-15 Thread limodou
Recently I found a wired problem in my application, something like this: I have a long time deamon program, it'll be an infinite loop, just like: engine = create_engine('...') conn = engine.connect() while True: for row in select: update sleep(xxx) In the loop, I create conn at