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
Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+. #10726
Conversation
@@ -141,7 +141,7 @@ def last_executed_query(self, cursor, sql, params): | |||
# With MySQLdb, cursor objects have an (undocumented) "_last_executed" | |||
# attribute where the exact query sent to the database is saved. | |||
# See MySQLdb/cursors.py in the source distribution. | |||
query = getattr(cursor, '_last_executed', None) | |||
query = getattr(cursor, '_executed', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we lookup both attributes until we drop support for mysqlclient<1.3.14
? I guess we could define a cached_property
that returns the correct attribute based on the current version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_executed
also exists in older versions. I tested with Django's documented minimum, mysqlclient 1.3.7.
@@ -141,7 +141,7 @@ def last_executed_query(self, cursor, sql, params): | |||
# With MySQLdb, cursor objects have an (undocumented) "_last_executed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to update the attribute name in the comment!
Would it be possible to backport to 1.11? :-) (Though the docs changes for 1.11/2.0 suggest it's perhaps a wontfix?) |
I did 2ea1e0e. I don't think it qualifies for a backport based on our supported versions policy. I'd rather you take the issue up with mysqlclient if you need the latest release. |
Makes sense, thank you. |
This was closed as wontfix. |
https://code.djangoproject.com/ticket/30013