On Jun 29, 2007, at 4:23 AM, mc wrote:

>
> Hi,
> I need to lock a table for WRITE.
> The scenario is that I have a SELECT followed by an INSERT, where the
> INSERT depends on the outcome of the SELECT. I have to make sure that
> no other process is modifying the table after my SELECT but before my
> INSERT.
>
> 1) How do i do it via SQLAlchemy ?
> 2) Is there any other method (not via locks) to achieve my goal?


the "traditional" way to do this is via SELECT...FOR UPDATE.   using  
a select(), add "for_update=True" as a KW argument.  also you have to  
be within a transaction.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to