Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

raw query with dictionary causes crash #309

Gibheer opened this Issue Aug 9, 2012 · 1 comment


None yet
3 participants

Gibheer commented Aug 9, 2012


if I want to build a custom query which takes a dictionary for parameters the debug toolbar crashes.

Person.object.raw('select %(id)s as id', {'id': 23})

The error message is

Exception Type: TypeError
Exception Value: format requires a mapping

@jezdez jezdez closed this Mar 2, 2013

jnns commented Aug 14, 2016

There seems to be a regression: inspecting a fully working RawQuery with django-debug-toolbar 1.5 results in an exception that int where expected, whereas str has been received.

Internal Server Error: /__debug__/sql_select/

Traceback (most recent call last):
  File "django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "debug_toolbar/panels/sql/views.py", line 19, in sql_select
    cursor.execute(sql, params)
  File "django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)

TypeError: list indices must be integers, not str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment