diff options
| author | Rob Hudson | 2011-09-26 21:18:35 -0700 |
|---|---|---|
| committer | Rob Hudson | 2011-09-26 21:18:35 -0700 |
| commit | 46f71cc5bef348e4d306e510f074e28d0047296b (patch) | |
| tree | f653eac28a9064e956647ec40350e97513f2da32 /debug_toolbar | |
| parent | 05088bcb457aa495467103f16f788be639146d34 (diff) | |
| download | django-debug-toolbar-46f71cc5bef348e4d306e510f074e28d0047296b.tar.bz2 | |
A little clean-up of last commit.
- Removed unused imports.
- Used already existing ms conversion
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/management/commands/debugsqlshell.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index 8878d25..1774a76 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -1,11 +1,10 @@ -import os -from optparse import make_option from datetime import datetime from django.db.backends import util from django.core.management.commands.shell import Command -from debug_toolbar.utils import sqlparse +from debug_toolbar.utils import ms_from_timedelta, sqlparse + class PrintQueryWrapper(util.CursorDebugWrapper): def execute(self, sql, params=()): @@ -15,9 +14,8 @@ class PrintQueryWrapper(util.CursorDebugWrapper): 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 - print 'Execution time: %fs' % execution_time.total_seconds() + print sqlparse.format(raw_sql, reindent=True), + print ' [%.2fms]' % (ms_from_timedelta(execution_time),) print util.CursorDebugWrapper = PrintQueryWrapper |
