OK, once you say engine.begin(), engine.rollback(), that is a database level transaction, so writing any data to the database within that block will not remain after you do the rollback....all calls to the engine are going to return the same connection that is part of the transaction, which has to do with the nature of the connection pool with the "use_threadlocal" flag. also doing a rollback() without the begin() at the engine level will do nothing since it doesnt have a connection object present with which to roll back on. since you need a connection from the engine that is not part of the current thread-local context, i just checked in a method "unique_connection()" that interacts with the pool to give you a connection that is guaranteed external to the current thread-local connection. by default, SQLAlchemy's pool returns the same thread-local connection if one is already checked out, so this method enables you to get around that. then execute as follows: engine.execute("insert into business(id) values(77)", connection=engine.unique_connection()) if the method isnt working, let me know. On Mar 14, 2006, at 1:47 PM, Qvx 3000 wrote: I guess I understand what you are saying but something is not right or I'm still missing something. |
- [Sqlalchemy-users] Autonomous transactions Qvx 3000
- Re: [Sqlalchemy-users] Autonomous transactions Michael Bayer
- Re: [Sqlalchemy-users] Autonomous transactions Qvx 3000
- Re: [Sqlalchemy-users] Autonomous transactions Michael Bayer
- Re: [Sqlalchemy-users] Autonomous transactions Qvx 3000
- Re: [Sqlalchemy-users] Autonomous transacti... Michael Bayer
- Re: [Sqlalchemy-users] Autonomous transacti... Michael Bayer
- Re: [Sqlalchemy-users] Autonomous tran... Michael Bayer
- Re: [Sqlalchemy-users] Autonomous ... Qvx 3000
- Re: [Sqlalchemy-users] Autonom... Michael Bayer
- Re: [Sqlalchemy-users] Autonom... Qvx 3000