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

Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+. #10726

Merged
merged 2 commits into from Dec 5, 2018

Conversation

timgraham
Copy link
Member

@@ -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)
Copy link
Member

@charettes charettes Dec 5, 2018

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?

Copy link
Member Author

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"
Copy link
Member

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!

@edmorley
Copy link
Contributor

edmorley commented Dec 6, 2018

Would it be possible to backport to 1.11? :-)

(Though the docs changes for 1.11/2.0 suggest it's perhaps a wontfix?)

@timgraham
Copy link
Member Author

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.

@edmorley
Copy link
Contributor

edmorley commented Dec 6, 2018

Makes sense, thank you.
I've filed PyMySQL/mysqlclient#303.

@edmorley
Copy link
Contributor

I've filed PyMySQL/mysqlclient-python#303.

This was closed as wontfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants