On Tuesday 23 May 2006 12:39, Christian Schneider wrote: > Hi Eric, > > no, it's not a one-off job but the cursor object looks easy enough. Do you > know what connection that is, i.e. is it the same one django will use for > the rest of my queries (I'm implementing a server that's supposed to run > 24/7) or do I have to shut it down. > > Thanks, > > chris > > On 5/23/06, Eric Walstad <[EMAIL PROTECTED]> wrote: > > On Tuesday 23 May 2006 12:17, Christian Schneider wrote: > > > Hi all, > > > > > > is it possible to update tables in bulk, that is in SQL "update jobs > > > set status=2 where worker='X'"? I'm using django from a backend server > > > > process > > > > > and speed is a bit of an issue here, so I'd like to avoid changing and > > > saving every object individually. > > > > > > chris > > > > Hi Chris, > > > > If it's a one-off task, I'd just do it at your DB's command > > line. Otherwise, > > have a look at the docs for executing arbitrary sql statements using > > Django's > > cursor object. I don't know of a Django orm method that does exactly > > what you want. > > > > < > > http://www.djangoproject.com/documentation/model_api/#executing-custom-sq > >l > > > > > > Best regards, > > > > Eric.
Hi Chris, I *think* that the cursor is cached in the django code, created if it doesn't already exist. You can, of course, use it outside of your web app (assuming you have a web app). Again, if the django code can find an existing cursor object, possibly from your previous queries, then it will use it (*). Have a look at the code in django/db (__init__.py, backends/yourdb/base.py, etc). It's interesting stuff and will help you understand what's going on. Eric. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---

