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

Error in signature of callproc() and execute() #966

Merged
merged 1 commit into from May 21, 2020
Merged

Error in signature of callproc() and execute() #966

merged 1 commit into from May 21, 2020

Conversation

pauricthelodger
Copy link
Contributor

Fixes #586

The default params () in the two NormalCursorWrapper methods should be None to match what django expects in the code block below. A bare cursor.execute(sql) will have params=() added to it by the Wrapper which fails to match the if in the code block below, causing the IndexError.

    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)
E               IndexError: tuple index out of range

django/db/backends/utils.py:65: IndexError

This fix was done @kevingill1966 in their fork, I'm just making a PR to have it added =)

@pauricthelodger
Copy link
Contributor Author

Example of a similar fix I did for the same issue in Scout a few years back, seems a lot of people did it the same way! =) scoutapp/scout_apm_python#43

Copy link
Member

@jkimbo jkimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks

@jkimbo jkimbo merged commit d07642a into graphql-python:master May 21, 2020
@pauricthelodger pauricthelodger deleted the issue-586 branch May 26, 2020 10:28
@jkimbo
Copy link
Member

jkimbo commented Jun 25, 2020

Released in v2.11.0

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

Successfully merging this pull request may close these issues.

NormalCursorWrapper has invalid sigatures for callproc and execute
2 participants