Context manager for Python’s MySQLdb
Previously, MySQLdb connections were context managers. As of this commit on 2018-12-04, however, MySQLdb connections are no longer context managers, and users must explicitly call conn.commit() or conn.rollback(), or write their own context manager, such as the one below. You could use something like this: import config import MySQLdb import MySQLdb.cursors as mc import _mysql_exceptions … Read more