aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/management/commands/debugsqlshell.py
diff options
context:
space:
mode:
Diffstat (limited to 'debug_toolbar/management/commands/debugsqlshell.py')
-rw-r--r--debug_toolbar/management/commands/debugsqlshell.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py
index 84b4a2f..eaeafd4 100644
--- a/debug_toolbar/management/commands/debugsqlshell.py
+++ b/debug_toolbar/management/commands/debugsqlshell.py
@@ -4,12 +4,7 @@ from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.db.backends import util
-# Optional sqlparse to make the SQL look pretty...
-# http://code.google.com/p/python-sqlparse/
-try:
- import sqlparse
-except ImportError:
- sqlparse = None
+from debug_toolbar.utils import sqlparse
class PrintQueryWrapper(util.CursorDebugWrapper):
def execute(self, sql, params=()):
@@ -17,10 +12,7 @@ class PrintQueryWrapper(util.CursorDebugWrapper):
return self.cursor.execute(sql, params)
finally:
raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params)
- if sqlparse:
- print sqlparse.format(raw_sql, reindent=True)
- else:
- print raw_sql
+ print sqlparse.format(raw_sql, reindent=True)
print
util.CursorDebugWrapper = PrintQueryWrapper