﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16054	Unexpected DB Caching Behaviour with MySQL	brendoncrawford	nobody	"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 = 'foo@localhost.com'
> 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 = 'bar@localhost.com'
> 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
}}}

"	Bug	closed	Database layer (models, ORM)	1.3	Normal	invalid		django@…	Unreviewed	0	0	0	0	0	0
