Skip to content

raw query with dictionary causes crash #309

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Gibheer opened this issue Aug 9, 2012 · 1 comment
Closed

raw query with dictionary causes crash #309

Gibheer opened this issue Aug 9, 2012 · 1 comment

Comments

@Gibheer
Copy link

Gibheer commented Aug 9, 2012

Hi,

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

@jnns
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants