Django logs SQL operations to an internal buffer (whether logging to file or not) when settings.DEBUG=True. Because I have long-running process that does a lot of DB operat
This worked for me (at least for Django 1.3.1):
from django.db import connection
connection.use_debug_cursor = False
I've found that variable inspecting Django source code (it is not documented), the relevant lines are found in django/db/backends/__init__.py
(BaseDatabaseWrapper
class):
def cursor(self):
if (self.use_debug_cursor or
(self.use_debug_cursor is None and settings.DEBUG)):
cursor = self.make_debug_cursor(self._cursor())
else:
cursor = util.CursorWrapper(self._cursor(), self)
return cursor