Thanks Micheal, that's what I hoped! iain
On Wed, Oct 16, 2013 at 12:13 PM, Michael Bayer <mike...@zzzcomputing.com>wrote: > > On Oct 16, 2013, at 1:38 PM, Iain Duncan <iainduncanli...@gmail.com> > wrote: > > > Hi folks, I'm working on a legacy database that has some issues with PK > generation. The long and short of it is that for now, I need to generate an > PK by locking a table, because that's what they've been doing. I'm using > the orm, and basically want to be able to use a session briefly with the > table locked. ( to find the highest PK in there and increment. I > know....hope we can fix that later ). I'm wondering what the best way to do > this is. > > > > I could use a connection to lock the table with raw sql, but then can I > use a session for the query? > > sure. session.execute("lock the table...") then keep using that Session > in the same transaction. once that Session has commit() called the > transaction is over and the lock will be cleared. > > > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.