>
> Thank you very much Mike 
>

We just tried this:

session.query(obj.__class__.version).with_for_update().filter(obj.__class__.id 
== obj.id).one()

attr['version'] = obj.version 

...


But the end result was the same:

IntegrityError: (IntegrityError) duplicate key value violates unique 
constraint "p2bases_history_pkey"

DETAIL:  Key (id, version)=(3, 8) already exists.

 'INSERT INTO p2bases_history (id, uuid, classname, "timeCreated", 
"timeModified", predecessor_id, predecessor_version, time, mark_as_deleted, 
mark_as_branched, version, changed) VALUES (%(id)s, %(uuid)s, 
%(classname)s, %(timeCreated)s, %(timeModified)s, %(predecessor_id)s, 
%(predecessor_version)s, %(time)s, %(mark_as_deleted)s, 
%(mark_as_branched)s, %(version)s, %(changed)s)' {'predecessor_version': 0, 
'mark_as_deleted': False, 'mark_as_branched': False, 'timeCreated': 
datetime.datetime(2014, 9, 11, 12, 50, 
tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=-300, name=None)), 'changed': 
datetime.datetime(2014, 12, 5, 0, 41, 39, 284872), 'classname': u'P2Page', 
'predecessor_id': None, 'version': 8, 'time': datetime.datetime(2014, 10, 
15, 13, 20, 6, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=-300, 
name=None)), 'id': 3, 'timeModified': datetime.datetime(2014, 10, 15, 13, 
20, 6, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=-300, name=None)), 
'uuid': u'00000001-0000-0000-0002-000000000001'}

(FYI: the example uses 'pbases' but in our real model is called "p2bases". 
The 'classname' cited there is the "P2Document" in our example)


Any other suggestion apart from retrying transactions?

(the failure rate would be very high because many users would typically add 
many notes concurrently to the same document)

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to