MySQL for Python

I am always for using the right tool for the right job. A lot of time, that tool is Python. I have always had trouble finding solid documentation on using MySQL with Python. There was generally enough to get by, but the more the merrier. Enter MySQL for Python by Albert Lukaszewski.

MySQL for Python Cover

MySQL for Python

As I mention in most of my reviews, on the of the things I love about Packt Publishing books is that they typically follow the same pattern: installation, teaching, project, summary. And my favorite piece is the mini projects given at the end of each chapter. It’s a little reality check for the reader reminding them that everything that they are doing has a real life application.

So skipping the installation chapter and jumping right in to the teaching, there is a lot of discussion about how to do the common stuff that one does in MySQL through Python. If you have a lot of experience with MySQL, then this is a handy reference. I also really like the fact that scattered throughout the book is information on becoming a better programmer (like tradeoffs on memory efficiency vs. performance).

Chapter 4 contained information about exception handling. Just like previous chapters, the amount of information on the handling of warnings and exceptions exceeds the boundaries of just MySQL in Python. This was a great review for any Python programmer. No need for further discussion as this chapter is available from Packt Publishing here.

The next few chapters deal with data manipulation in Python. This includes INSERTs, UPDATEs, DELETEs, etc. Chapter 8 specifically deals with user management in MySQL. This is a great skill to have regardless of the interface that you are using to tie into MySQL. Most programmers neglect the concept of administration and leave it to the DBAs or the SysAdmins. Albert takes the reader through some admin exercises including user management, backup and recovery, and accessing the MySQL meta information like information_schema tables. There was also discussion about the various storage engines which was unexpected.

Bouncing backwards a little was a lesson on the string and aggregation functions built into MySQL. A lot of these capabilities are usually handled programatically and not off-loaded to the database like it should be. Again, this is a great refresher (or even initial) lesson for any programmer who spends a lot of time building and maintaining complex queries.

Overall this book was another great teaching tool put forth by the folks at Packt. The audience is definitely not at the beginner Python programmer, but an intermediate level developer would have no issues understanding everything. You can find this book either at Amazon or directly from Packt Publishing.