Hello,
I have a quite serious problem with the MySQLdb library in Python (2.6 in Debian Stable as well as 2.7 in OpenSuse 12.1). An example will be probably the easiest way to show what I mean:
Code:
connection = MySQLdb.connect(...)
sql = 'SELECT * FROM file WHERE disk > 4000 and disk < 5000'
cursor = connection.cursor()
cursor.execute(sql)
data = cursor.fetchall()
...
Now change data in the server that satisfy the WHERE condition. We can test it with some other client like phpmyadmin or the CLI client. Now try to get the data in code again:
Code:
...
cursor = connection.cursor()
cursor.execute(sql)
data = cursor.fetchall()
cursor.fetchall() returns the same data as before the changes! It probably doesn't actually query the MySQL server, but returns some cached result instead?
Is this the intended behaviour? And how can I change it other than disconnect and connect again?
BTW does anyone know how to contact the MySQLdb author? I couldn't find any contact, either on PyPi as well as SF (where MySQLdb is hosted). Also, could anyone point me to the bug database?