Greetings list,

A user recently emailed me about concurrent modifications and the
versioning extension off-list.  My original intention was to allow
the user to somewhat decide how to handle concurrent modifications
on their own.  The default behavior is pretty undesirable, in that
you could end up with two version rows with the same version number
in the case of concurrent writes.

SQLAlchemy has a `version_id_col` argument that can be specified
to the mapper constructor that will use a 0-based integer version
column to watch for concurrent modification errors.  I have made a
patch to the versioning extension which makes it possible to have
this capability turned on for your versioned entities, so that
ConcurrentModificationErrors will be raised in the case of these
concurrent writes.

I am attaching a patch to this email, and I'd like to get feedback
on how I have implemented it.  This was a quick job that I did
late last night when fighting off insomnia, so I am not entirely
confident in it, and I'd like to hear what people have to say about
it.

The patch essentially adds an `enforce` keyword argument to the
`acts_as_versioned` statement.  If you pass `True` the extension
will enable this new behavior.

If I get enough positive feedback, I'll commit it to the trunk.  Its
something that should really be there, I am just not confident that
I have done it "right" yet :)

--
Jonathan LaCour
http://cleverdevil.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to