Skip to content

Commit 46f71cc

Browse files
committed
A little clean-up of last commit.
- Removed unused imports. - Used already existing ms conversion
1 parent 05088bc commit 46f71cc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import os
2-
from optparse import make_option
31
from datetime import datetime
42

53
from django.db.backends import util
64
from django.core.management.commands.shell import Command
75

8-
from debug_toolbar.utils import sqlparse
6+
from debug_toolbar.utils import ms_from_timedelta, sqlparse
7+
98

109
class PrintQueryWrapper(util.CursorDebugWrapper):
1110
def execute(self, sql, params=()):
@@ -15,9 +14,8 @@ def execute(self, sql, params=()):
1514
finally:
1615
raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params)
1716
execution_time = datetime.now() - starttime
18-
print sqlparse.format(raw_sql, reindent=True)
19-
print
20-
print 'Execution time: %fs' % execution_time.total_seconds()
17+
print sqlparse.format(raw_sql, reindent=True),
18+
print ' [%.2fms]' % (ms_from_timedelta(execution_time),)
2119
print
2220

2321
util.CursorDebugWrapper = PrintQueryWrapper

0 commit comments

Comments
 (0)