Which backend are you using? If you happen to be using MySQL with InnoDB, and you haven't altered the default settings you are probably using an isolation level of REPEATABLE-READ.
You can read more about that setting here http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html#isolevel_repeatable-read If that is your issue there are two suggestions on how to solve the problem here http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06d/55fa3724d2754013?#55fa3724d2754013 . Craig On Thu, Jun 25, 2009 at 1:48 PM, afrobeard <afrobe...@gmail.com> wrote: > > Thanks for the reply Alex, however I beleive I might have > miscommunicated the problem a big. The actual format of the daemon is > somewhat like this:- > > 1while True: > 2 rs = Inqueue.objects.filter(processed = 0).order_by('-timestamp') > 3 for item in rs: > 4.1 processitem(item) > 4.2 item.delete() > 5 sleep > > > > On Jun 26, 2:32 am, Alex Gaynor <alex.gay...@gmail.com> wrote: > > On Thu, Jun 25, 2009 at 3:31 PM, afrobeard <afrobe...@gmail.com> wrote: > > > > > I have a problem where I'm using Django, specifically the ORM in a non > > > web based daemon script to process some data from a site, by setting > > > the environment variables respectively so that it knows where the > > > settings module is, etc > > > > > I'm running the following query:- > > > > > Inqueue.objects.filter(processed = 0).order_by('-timestamp') > > > > > Now the thing is that it gets the right results the first time, but if > > > someone makes a change on the site that the script itself is unaware > > > of, it does not get new items that were added onto the site until the > > > script is restarted. It behaves as if it's using some caching system. > > > > > Everything works fine on an Ubuntu server, however not on windows > > > machines. I'm not sure why, the python and django versions are the > > > same on both systems. > > > > > Can anybody point me to what could be causing this behavior? > > > > > Thanks in advance > > > > When a queryset is iterated over it stores the data so if you iterate > over > > the same queryset object again it doesn't do another DB query. If you > want > > to iterate over a new one instead of the current one you can just do > > queryset.all() and then you won't be going through the cache. > > > > Alex > > > > -- > > "I disapprove of what you say, but I will defend to the death your right > to > > say it." --Voltaire > > "The people's good is the highest law."--Cicero > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---