#17771: weird problem db with autocommit ----------------------------------------------+-------------------- Reporter: meister | Owner: nobody Type: Bug | Status: new Component: Database layer (models, ORM) | Version: 1.3 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------------------+-------------------- Hello,
Here is problematic code (standard django setup, mysql backend): {{{ import time import os, sys, re sys.path.append(os.path.abspath(os.path.dirname(__file__))+'/..') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.conf import settings from django.contrib.auth.models import User #from django.db import connection #cursor = connection.cursor() #cursor.execute('SET autocommit = 1') while True: u = User.objects.get(pk=1) print u.first_name time.sleep(1) }}} It displays user first_name each second. On the other hand with mysql client : {{{ $ update auth_user set first_name = "foo" where id=1; }}} Value does not update in my loop (wireshark shows the old value too in the mysql packets dumped). If I restart the process, it fetch the correct new value. I can fix the problem by adding the 3 autocommit lines commented out. Problem do not occur on my ubuntu 32b desktop (32bits django 1.3.1 / MySQL-python 1.2.3, mysql 5.1.58) nor a debian squeeze server (32bits mysql 5.1.49). Problem occurs on a 64 bits debian squeeze server (64bits mysql 5.1.49) and a ubuntu 64 server (64 bits mysql 5.1.41). Thanks. -- Ticket URL: <https://code.djangoproject.com/ticket/17771> 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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.