Skip to content
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

Raw query execution issue with Django 1.9 #844

Closed
valignatev opened this issue Jun 24, 2016 · 0 comments
Closed

Raw query execution issue with Django 1.9 #844

valignatev opened this issue Jun 24, 2016 · 0 comments

Comments

@valignatev
Copy link
Contributor

valignatev commented Jun 24, 2016

Hi! Don't sure if it's in Django 1.9 only.
So let's have a code with custom query execution:

with connection.cursor() as c:
    c.execute(query) 

Then we've got an exception:

/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
IndexError: tuple index out of range

The problem is that in django code execution signature is:

def execute(self, sql, params=None):
    self.db.validate_no_broken_transaction()
    with self.db.wrap_database_errors:
        if params is None:
            return self.cursor.execute(sql)
        else:
            return self.cursor.execute(sql, params)

And in debug-toolbar is:

 def execute(self, sql, params=()):
     return self._record(self.cursor.execute, sql, params)

Also same issue goes with callproc method

I'll also make PR to fix this if you don't mind :)

valignatev added a commit to valignatev/django-debug-toolbar that referenced this issue Jun 24, 2016
aaugustin added a commit that referenced this issue Jun 24, 2016
#844 fix tuple index out of range error
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
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

1 participant