conn = engine.connect() trans = conn.begin() ...etc trans.commit() table locking is usually either implicit to SQL operations performed within the transaction or using a construct like SELECT..FOR UPDATE, but you can still issue your straight text if you like (but LOCK TABLES isnt portable).
On Jun 21, 5:41 pm, "Can Xue" <[EMAIL PROTECTED]> wrote: > I'm using MySQL and when I need to lock a table, I do: > > conn = engine.connect() > conn._autocommit = dummyFunc > conn.execute("LOCK TABLES tablename WRITE") > try: > ... > conn.execute("COMMIT") > except: > conn.execute("ROLLBACK") > ... > finally: > conn.execute("UNLOCK TABLES") > conn.close() > > Are there any more pythonic ways to do such tasks? > > -- > > XUE Can --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---