My Python program queries a set of tables in a MySQL DB, sleeps for 30 seconds, then queries them again, etc. The tables in question are continuously updated by a third-par
This website and this website contain information on the same problem. In order to keep your tables up to date, you must commit your transactions. Use db.commit() to do this.
As mentioned by the post below me, you can remove the need for this by enabling auto-commit. this can be done by running db.autocommit(True)
Also, auto-commit is enabled in the interactive shell, so this explains why you didn't have the problem there.