We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e08ec8c commit d0c424cCopy full SHA for d0c424c
debug_toolbar/management/commands/debugsqlshell.py
@@ -1,5 +1,6 @@
1
import os
2
from optparse import make_option
3
+from datetime import datetime
4
5
from django.core.management.base import NoArgsCommand
6
from django.db.backends import util
@@ -8,12 +9,16 @@
8
9
10
class PrintQueryWrapper(util.CursorDebugWrapper):
11
def execute(self, sql, params=()):
12
+ starttime = datetime.today()
13
try:
14
return self.cursor.execute(sql, params)
15
finally:
16
raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params)
17
+ execution_time = datetime.today() - starttime
18
print sqlparse.format(raw_sql, reindent=True)
19
print
20
+ print 'Execution time: %fs' % execution_time.total_seconds()
21
+ print
22
23
util.CursorDebugWrapper = PrintQueryWrapper
24
0 commit comments