I'm trying to lock a number of the oldest rows in a table.
update job set lock='lockid' where lock ='' order by created limit 10;
Ideally id like to do something like this:
Job.objects.filter(lock='').order_by('created').update(lock='lockid')
[0:10]
Now i'm just using raw sql to lock which is fine but it would be great
if there was a way to do it with the orm.
Appreciate any advice
Thanks
This is unlikely to be supported by Django; "UPDATE ... LIMIT" is
non-standard, non-portable and MySQL is the only DB supporting it out
of the box.
--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."