Hello,

I have a transaction that involves a SELECT and subsequent UPDATE.  It
is operating against MSSQL.  I need to make sure that the row locks so
that other processes may not access it until I have completed my
update, or that they at least fail when trying to UPDATE after the
first transaction commits.

I think that either FOR UPDATE or UPDLOCK would work, but I can't find
a way to make either of them work.  In the mmsql.py file I find this
code:
    def for_update_clause(self, select):
        # "FOR UPDATE" is only allowed on "DECLARE CURSOR" which
SQLAlchemy doesn't use
        return ''

This leads me to believe that FOR UPDATE will not work.

I've also tried this
s = select(table.c, table.c.field>0, [text("(UPDLOCK)")])
conn.execute(s)

Rather than producing "SELECT * FROM table (UPDLOCK) where field > 0"
it instead produces  "SELECT * FROM table, (UPDLOCK) where field > 0"

That little comman throws the whole thing off.  Can anyone suggest a
way for me to accomplish what I'm trying to do in sqlalchemy.

Thanks in advance,
Daniel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to