How to disable query cache with mysql.connector
Solution 1:
I solved this by adding the code after fetchall()
con.commit()
Calling the same select query without doing a commit, won't update the results.
Solution 2:
The solution is to use:
-
Once:
con.autocommit(True)
-
Or, after each select query:
con.commit()
With this option, there will be a commit after each select query. Otherwise, subsequent selects will render the same result.
This error seems to be Bug #42197 related to Query cache and auto-commit in MySQL. The status is won't fix!
In a few months, this should be irrelevant because MySQL 8.0 is dropping Query Cache.