MySQL for Python
By Albert Lukaszewski
Last month, I was approached by Packt Publishing’s Marketing department to do a review of their new book, MySQL for Python by Albert Lukaszewski. The book is 440 pages and I was expected to read this pretty quickly. Unfortunately, real life got in the way and I am just going to do a mini-review of what I’ve managed to read of the book (i.e. 161 pages + skimming). Why? Because they’re marketing department keeps bugging me. In future, I plan to just buy my own books so I don’t have these silly time limits.
Another reason that it’s taking me so long to read this is because I only got an ebook copy, which makes it less than convenient to read. I admit that I like real books better. They don’t dry out my eyes nearly as quickly as a monitor does. That and I discovered that MySQL doesn’t really interest me a great deal…But you didn’t come to my blog to read about my whining did you? Let’s get to the meat and see if this book is worth your hard earned pennies!
On with the Review!
This book has some pretty serious credentials behind it. The author writes the “About Python” column on About.com and the reviewers cover the gamut of author, primary coder behind MySQL for Python and a member of the MySQL support team at Sun/Oracle. The writing in the book is (as expected) quite good. I will admit to finding it a little dry though. However, I have yet to read a thrilling database book.
Anyway, the book’s first chapter is all about getting MySQL and MySQL for Python set up on your machine. You can get this information off each of the respective project’s websites. The second and third chapter go over basic SQL syntax with a few Python examples here and there. This threw me a little because I had assumed that the book was for people who already knew SQL and were getting the book to learn how to interface with MySQL using the Python programming language. There’s nothing particularly wrong with these chapters, but I was hoping for more Python, less SQL. Your tastes will probably differ.
The last chapter I read was the 4th one, which is about Exception Handling. The author spends a lot of time talking about the differences between warnings and exceptions and how you should handle them. The text also goes over the various custom errors that the MySQL for Python package can catch.
I read about half of chapter 5. It covers how to retrieve results record-by-record using the fetchone() and fetchmany() methods along with loops and iterators. I didn’t get to the movie database project at the end of the chapter.
The chapters I haven’t gotten to yet cover the following topics: Inserting multiple entries, creating and dropping (tables, I assume); creating users and granting access (permissions or security, I think); date and time values, aggregate functions and clauses; SELECT alternatives; string functions; showing MySQL metadata; and finally, disaster recovery.
From what I read, I think the book covers the topics well. While I found much it to be review (and thus, kind of boring), I would think that I would have found this book very helpful as a new programmer learning SQL and Python. I tend to use SqlAlchemy for all my database work now though. Still, if you need to know this topic or want to learn how to connect to MySQL with Python and NOT use an ORM like SqlAlchemy, then this is the book for you! Otherwise, try to preview it on Amazon’s website or in a book store to make sure it will fit your needs.
1 thought on “Mini Book Review: MySQL for Python”
Reviewer wrote: “if you need to know this topic or want to learn how to connect to MySQL with Python and NOT use an ORM like SqlAlchemy, then this is the book for you!” — what 440 pages! For most of us, that’s a 404 😉
There is a single-file Python NoSQL module called y_serial which takes less than 10 minutes to understand and incorporate into one’s code.
y_serial = serialization + persistance. In a few lines of code, compress and annotate Python objects into SQLite; then later retrieve them chronologically by keywords without any SQL. Highly useful NoSQL â€œstandardâ€ module for a database to store schema-less data. http://yserial.sourceforge.net/
It’s case usage will cover most non-mega-scale projects, and it’s cost is zero. Highly reliable, and future-proof against myOracleSQL — because it’s entirely Pythonic.
Comments are closed.