Is there a best practice or recipe for handling database concurrency when using SQLAlchemy with Pyramid?
I'm considering porting a desktop accounting application to the web with Pyramid/SQLAlchemy. Assume that a user opens an invoice for editing. Assume that before this user POSTs the changes, another user opens the same invoice and posts changes. While with 'desktop' SQLAlchemy, the update is protected by a database transaction, I don't think that's true on the web. Here's my first thought of a possible solution. Assume the invoice is represented by a one-many relationship between a header and detail table. There could be a write count field in the header that is automatically incremented every time the invoice is updated. This write count could be saved in a hidden field (or in the user's session). When the inovice is POSTed, the write count field could be compared with the write count in the database and an error issued if they don't match. Are there any problems with this approach, or is there a better solution? Thanks, Mark -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
