Thank's all for the replies but I am not sure it solves my specific problem. As I understand, "FOR UPDATE" locks the rows that were selected.
My problem is as follows: I select for something. If that row does not exists, I need to insert it. I want to avoid the situation where some other client inserts the row after I have selected (and found out it does not exist) but before I insert it myself. In direct SQL, I would LOCK the table for WRITE before the select, and release the locks after the insert. Can that be done through SQLAlchemy? On Jun 29, 4:38 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Jun 29, 2007, at 4:55 AM, Andreas Jung wrote: > > > At least the select() method has an optional parameter 'lockmode'. > > You might check the docs and the release notes. > > lockmode is specific to the ORM. these days it looks like > query.with_lockmode('read').filter(...).. it results in FOR UPDATE > statements. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---