#16054: Unexpected DB Caching Behaviour with MySQL
----------------------------+----------------------------------------------
Reporter: | Owner: nobody
brendoncrawford | Status: new
Type: Bug | Component: Database layer (models, ORM)
Milestone: | Severity: Normal
Version: 1.3 | Triage Stage: Unreviewed
Keywords: | Easy pickings: 0
Has patch: 0 |
----------------------------+----------------------------------------------
This example demonstrates faulty caching behaviour using Django ORM with
MySQL...
{{{
## iPython Shell 1
> from django.contrib.auth.models import User
## iPython Shell 2
> from django.contrib.auth.models import User
## iPython Shell 1
> a = User()
> a.username = 'foo'
> a.email = '[email protected]'
> a.save()
> print a.id
>> 1
## iPython Shell 2
> print User.objects.get(pk=1).id
>> 1
## MySQL Shell 1
> SELECT id FROM auth_user WHERE id = 1
>> 1
## iPython Shell 1
> b = User()
> b.username = 'bar'
> b.email = '[email protected]'
> b.save()
> print b.id #2
## iPython Shell 2
> print User.objects.get(pk=2).id
>> Raises User.DoesNotExist
## MySQL Shell 1
> SELECT id FROM auth_user WHERE id = 2
>> 2
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16054>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.