Thanks to everyone for the replies here.

Just to be clear:  I don't think that this is a transactions issue.  The 
Django-side part of this problem doesn't have transactions enabled, and 
the MySQL-side is just a direct transactionless operation on the DB that 
can be seen immediately by other clients.


Michael Radziej wrote:
> Greg Plesur schrieb:
>> Hi all,
>>
>> I'm a new subscriber to this list, and am having an issue that I'm 
>> hoping you can help me with (I also posted this as a trouble-ticket, 
>> because I'm not seeing any references to this issue anywhere and it 
>> seems buggy):
>>
>> It looks like my models are caching their DB query in a way that I can't 
>> clear.
>>
>> If I call "Model.objects.all()" and then make any changes to the DB with 
>> my MySQL client, the results of subsequent Model.objects.all() 
>> invocations never changes.
>>
>> Example, with model PendingAlert:
>>
>>              PendingAlert.objects.all()
>>
>> [<PendingAlert: PendingAlert object>, <PendingAlert: PendingAlert object>]
>>
>> (...now, in mysql...) mysql> delete from pending_alert; Query OK, 2 rows 
>> affected (0.00 sec)
>>
>> (...now, back in my Django session)
>>
>>              PendingAlert.objects.all()
>>
>> [<PendingAlert: PendingAlert object>, <PendingAlert: PendingAlert object>]
>>
>> ...I just verified - the first Django session never clears its cache 
>> even if I alter the pending_alert table using Django instead of straight 
>> in MySQL.
>>
>> Just to make sure that I have the right mental model here: Isn't 
>> Model.objects.all() supposed to create a QuerySet with its own search? 
>> Shouldn't these calls be touching the database directly?
>>
>> Any help would be appreciated here - thanks,
> 
> This is not caching, it rather looks like a problem with 
> transactions. You should make sure that you make a commit after 
> the delete. How to do it, depends on your setup. Perhaps the 
> following URL gets you back on track quickly:
> 
> http://www.djangoproject.com/documentation/transactions/
> 
> 
> Hope this helps,
> 
> Michael
> 
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to