-
Notifications
You must be signed in to change notification settings - Fork 769
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
When using DjangoDebugMiddleware, debug tracking presumes cursor.execute argument is a string, raising an error #960
Comments
@yourcelf We experienced that as well. Haven't decided yet how to fix for a PR here for it but in our package we now have a lot of executes that look like this:
|
Ran into the same issue. A possibly naive solution from playing around in my debugger. It fixed the issue in my case, but unsure of the side effects beyond the scope of this function.
|
This does look like a bug but unfortunately I don't have enough time at the moment to look into it more deeply. If someone would like to try and fix it that would be much appreciated. |
NormalCursorWrapper falls with UnicodeDecodeError in python 2
|
I like @mtully-blitz solution, doesn't appear incorrect. |
When using the
DjangoDebugMiddleware
, Graphene Django wrapscursor.execute
calls in a class that logs the query. Among the properties it logs isis_select
, which attempts to guess if a query is a select query by looking for "select" in the argument tocursor.execute
:When
cursor.execute
is called with a non-string argument, such as a psycopg2 query template, this raises an error:This raises:
What is the expected behavior?
Grahene Django should not presume that the argument to
connection.cursor()
will always be a string, and do appropriate string coercion as needed before calling string methods on it.What is the motivation / use case for changing the behavior?
Robustness. It's ideal not to throw exceptions from normal uses of core Django methods which graphene-django monkeypatches.
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: