Don’t omit the commit

I’m slowly making progress at converting my old blog from Manila to WordPress; it looks like the simplest approach is to write a bunch of Python scripts to read the “content-only” version of the blog, resolve intra-blog references, and then directly insert the result into the underlying MySQL database using MySQLdb.

In testing this approach, I was trying to create a posting from scratch in a copy of WordPress running on my machine; I based the program on the examples I found here and here. But, even though the program seemed to work, and I could read the changes while the program was executing, but after the program finished, the database never reflected the changes — except that the ID for new entries kept increasing every time I ran the program.

It took me a long time to figure out what was wrong, but I eventually guessed it: I had to do an explicit “COMMIT” to have the changes I made from Python stick. I don’t know why the examples don’t show this, but it sure makes a difference.

More to come, I hope.