On Jan 11, 2009, at 10:44 AM, Darren Govoni wrote:

>
> Hi,
>  I have 2 records in the database. I made an expression to update only
> 1 record, but all are getting updated.
>
>
> works=session.query(Work).filter(tnow- 
> Work.taken<timedelta(minutes=15))
> .filter 
> (Work 
> .completed==None).limit(1).with_lockmode(mode='update').update(values)
>
> Shouldn't the above query only perform the update on the limited  
> results
> of the query?


query.update() just issues an UPDATE statement.  UPDATE doesn't  
support any kind of LIMITing keywords (maybe MySQL does, but thats not  
SQL).   The Query should really be raising an error here without  
emitting any SQL.

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to