From: Larry Martell Date: April 30 2012 8:48pm Subject: cursor._last_executed List-Archive: http://lists.mysql.com/mysql/227277 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 I am working on a django app, and it's blowing up in this in django/db/backends/mysql/base.py: def last_executed_query(self, cursor, sql, params): # With MySQLdb, cursor objects have an (undocumented) "_last_executed" # attribute where the exact query sent to the database is saved. # See MySQLdb/cursors.py in the source distribution. return cursor._last_executed with 'Cursor' object has no attribute '_last_executed' Sure enough, it does not: $ python Python 2.6.7 (r267:88850, Jan 11 2012, 06:42:34) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import MySQLdb >>> conn = MySQLdb.connect(host, user, passwd, db) >>> cursor = conn.cursor() >>> print cursor._last_executed Traceback (most recent call last): File "", line 1, in AttributeError: 'Cursor' object has no attribute '_last_executed' >>> print cursor.__dict__ {'_result': None, 'description': None, 'rownumber': None, 'messages': [], '_executed': None, 'errorhandler': >, 'rowcount': -1, 'connection': , 'description_flags': None, 'arraysize': 1, '_info': None, 'lastrowid': None, '_warnings': 0} Anyone know anything about this undocumented (and nonexistent) attribute? I've asked on the django list, but have not received any replies.