36 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: concurent modification
FromSent OnAttachments
imgrey22 Nov 2007 11:28 
Sanjay22 Nov 2007 23:43 
imgrey23 Nov 2007 00:58 
Michael Bayer23 Nov 2007 08:03 
imgrey27 Nov 2007 11:39 
King Simon-NFHD7828 Nov 2007 01:33 
Michael Bayer28 Nov 2007 07:20 
imgrey28 Nov 2007 07:38 
Michael Bayer28 Nov 2007 08:37 
imgrey28 Nov 2007 09:03 
Michael Bayer28 Nov 2007 10:40 
imgrey28 Nov 2007 12:29 
Michael Bayer28 Nov 2007 14:07 
imgrey30 Nov 2007 06:36 
Michael Bayer30 Nov 2007 07:15 
imgrey30 Nov 2007 10:44 
Michael Bayer30 Nov 2007 11:06 
imgrey30 Nov 2007 12:06 
Michael Bayer30 Nov 2007 13:13 
imgrey30 Nov 2007 15:21 
Michael Bayer30 Nov 2007 22:01 
imgrey01 Dec 2007 16:24 
Michael Bayer01 Dec 2007 16:37 
Michael Bayer02 Dec 2007 10:22 
imgrey03 Dec 2007 15:32 
Michael Bayer03 Dec 2007 16:50 
imgrey06 Dec 2007 05:57 
Michael Bayer06 Dec 2007 08:50 
imgrey10 Dec 2007 16:45 
imgrey11 Dec 2007 13:43 
Michael Bayer11 Dec 2007 13:55 
imgrey11 Dec 2007 14:53 
Michael Bayer11 Dec 2007 15:14 
imgrey14 Dec 2007 18:24 
Michael Bayer14 Dec 2007 20:01 
imgrey20 Dec 2007 23:35 
Subject:[sqlalchemy] Re: concurent modification
From:King Simon-NFHD78 (simo@motorola.com)
Date:11/28/2007 01:33:06 AM
List:com.googlegroups.sqlalchemy

imgrey wrote:

Based on my observations it happens only with concurent inserts/ updates. One thread :

{{{ f_table.insert().execute() session.flush() transaction = session.begin() nested = session.begin_nested() try: f_table.insert().execute() except IntegrityError: #record is exists and we got exception corresponding to contraint stuff = session.query(Path).select_from(..) ..update.. nested.commit()

transaction.commit() session.clear() }}}

Another thread: {{{ f_table.delete(...) #or update }}}

I'm probably completely wrong about this, but in your example above, I don't think the statement f_table.insert().execute() necessarily uses the same connection as the ORM-level transaction and queries.

Using SQL expressions with ORM transactions is covered in this section of the docs:

http://www.sqlalchemy.org/docs/04/session.html#unitofwork_sql

Hope that helps,

Simon