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

Projects
None yet
4 participants
@timgraham
Copy link
Member

timgraham commented Dec 5, 2018

@@ -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)

This comment has been minimized.

@charettes

charettes Dec 5, 2018

Member

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?

This comment has been minimized.

@timgraham

timgraham Dec 5, 2018

Author Member

_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"

This comment has been minimized.

@pope1ni

pope1ni Dec 5, 2018

Contributor

Don't forget to update the attribute name in the comment!

@timgraham timgraham force-pushed the timgraham:30013 branch from 7fb713e to 734ce71 Dec 5, 2018

@timgraham timgraham merged commit 734ce71 into django:master Dec 5, 2018

18 of 19 checks passed

pull-requests-bionic/database=sqlite3,label=bionic-pr,python=python3.5 Build #2880 ended
Details
docs Build #17811 ended
Details
flake8 Build #17919 ended
Details
isort Build #17954 succeeded in 24 sec
Details
pr-mariadb/database=mysql,label=mariadb,python=python3.7 Build #2401 ended
Details
pr-mariadb/database=mysql_gis,label=mariadb,python=python3.7 Build #2401 ended
Details
pull-requests-bionic/database=mysql,label=bionic-pr,python=python3.5 Build #2880 ended
Details
pull-requests-bionic/database=mysql,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-bionic/database=mysql_gis,label=bionic-pr,python=python3.5 Build #2880 ended
Details
pull-requests-bionic/database=mysql_gis,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-bionic/database=postgis,label=bionic-pr,python=python3.5 Build #2880 ended
Details
pull-requests-bionic/database=postgis,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-bionic/database=postgres,label=bionic-pr,python=python3.5 Build #2880 ended
Details
pull-requests-bionic/database=postgres,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-bionic/database=spatialite,label=bionic-pr,python=python3.5 Build #2880 ended
Details
pull-requests-bionic/database=spatialite,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-bionic/database=sqlite3,label=bionic-pr,python=python3.7 Build #2880 ended
Details
pull-requests-javascript Build #14314 ended
Details
pull-requests-windows/database=sqlite3,label=windows,python=Python35 Build #9920 ended
Details

@timgraham timgraham deleted the timgraham:30013 branch Dec 5, 2018

@edmorley

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

timgraham commented Dec 6, 2018

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

This comment has been minimized.

Copy link
Contributor

edmorley commented Dec 6, 2018

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

@edmorley

This comment has been minimized.

Copy link
Contributor

edmorley commented Dec 10, 2018

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
You can’t perform that action at this time.