Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-21 Thread Thierry Florac
Hi Michael, I applied your patch on my current SA 0.7.3 without any problem, and added a few traces. Everything seems to work perfectly! Here is the first output with updates: do_begin_twophase do_prepare_twophase = True do_commit_twophase oci_prepared = True do_commit and

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-21 Thread Michael Bayer
On Nov 21, 2012, at 5:32 AM, Thierry Florac wrote: Hi Michael, I applied your patch on my current SA 0.7.3 without any problem, and added a few traces. Everything seems to work perfectly! Here is the first output with updates: do_begin_twophase do_prepare_twophase = True

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-21 Thread Michael Bayer
this will need lots more work on my end and may not be possible without major caveats. once you use connection.begin(*xid), the cx_oracle connection goes into a new mode that seems to render the usual DBAPI contract of implicit begin permanently broken. I've spent about three hours trying to

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-20 Thread Thierry Florac
Hi Michael, This is a complete traceback produced by removing my checking code against attribute modification. Original code is then as simple as this: @ajax.handler def updateOrderMenuItemBO(self): session = getSession(SESSION_NAME) ids = [ int(id) for id in

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-20 Thread Michael Bayer
Googling for the ORA code yields the usual tautological answers that say nothing. The first step here would be to isolate the issue in a simple test case with SQLAlchemy only, and then cx_oracle where I suspect the bug lies. The Session will not create a transaction at all, if no SQL is

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-20 Thread Thierry Florac
Hi Michael, Following your guidelines, this is the first test I made against cx_Oracle : conn = cx_Oracle.connect('scott','tiger','localhost:1521/ORCL', twophase=True) id = random.randint(0, 2 ** 128) xid = (0x1234, %032x % id, %032x % 9) conn.begin(*xid) conn.prepare() False conn.commit()

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-20 Thread Michael Bayer
great. can you try the attached patch please (latest 0.8 tip), which will not call commit if the prepare returned false. I'm not sure if this is complete though, if we should be doing a rollback afterwards, or what. not sure if I can get my local oracle XE to do two phase for real, that

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-19 Thread Thierry Florac
Le Mon, 19 Nov 2012 10:23:14 -0500, Michael Bayer mike...@zzzcomputing.com a écrit: On Nov 19, 2012, at 8:10 AM, Thierry Florac wrote: Hi, I'm using SQLALchemy (currently 0.7.3 in this project, also tested with 0.7.9) with cx_Oracle-5.1.1 in a Zope3 project. SQLAlchemy

Re: [sqlalchemy] SQLAlchemy transaction problem

2012-11-19 Thread Michael Bayer
On Nov 19, 2012, at 6:23 PM, Thierry Florac wrote: As far as I can understand it, I'm globally OK with you but... probably not completely :-\ I agree with the fact that SQLAlchemy is not the only package which takes part into the global transaction, as SA's session is handled by a Zope