diff options
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/management/commands/debugsqlshell.py | 10 | 
1 files changed, 6 insertions, 4 deletions
diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index e96f46d..45a23c2 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -1,3 +1,5 @@ +from __future__ import print_function +  from datetime import datetime  from django.db.backends import util @@ -14,9 +16,9 @@ class PrintQueryWrapper(util.CursorDebugWrapper):              return self.cursor.execute(sql, params)          finally:              raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params) -            execution_time = datetime.now() - starttime -            print sqlparse.format(raw_sql, reindent=True), -            print ' [%.2fms]' % (ms_from_timedelta(execution_time),) -            print +            execution_time = ms_from_timedelta(datetime.now() - starttime) +            formatted_sql = sqlparse.format(raw_sql, reindent=True) +            print('%s [%.2fms]' % (formatted_sql, execution_time)) +  util.CursorDebugWrapper = PrintQueryWrapper  | 
