Saturday, December 08, 2012

MySQLdb ≠ autocommit

Something else I've learned recently is that MySQLdb disables autocommit.



How annoying, I thought, and immediately added con.autocommit(True) to my code.

And then I realized I was about to add a whole bunch of child records (in two tables) along with their parent record. Wait a minute... I really don't want to enable autocommit, I want to con.commit() instead!

No comments: