MySQL connector issue

Joseph L. Casale jcasale at activenetwerx.com
Sun Oct 23 09:59:41 EDT 2016


I have some code that I am testing on Windows without c extensions which
runs on a RHEL server with c extensions. In a simplified test case as follows:

connection = mysql.connector.connect(...)
cursor = connection.cursor(cursor_class=MySQLCursorDict)
while True:
    cursor.execute('SELECT foo,biz FROM bar WHERE baz IS NULL)
    rows = cursor.fetchall()
    print(rows)

    cursor.execute('UPDATE bar SET baz=42 WHERE baz IS NULL')
    connection.commit()

    sleep(.5)

This works on Windows, the select query consistently returns new results as they
appear in the database when generated by other applications.

However on the RHEL server, the initial select only produces a result on the first
iteration and then as new results are written to the database, the select does not
find results?

What might be the issue?

Thanks,
jlc



More information about the Python-list mailing list