Go to this page:
http://www.kitebird.com/articles/pydbapi.html
Perform the tests at the top of the page to confirm your installation.
Then work your way through writing and running the animal.py script.
Sign Up With LinuxMagazine.com .
For the first unit, go the the article MySQL 5 Stored Procedures, Views, and Triggers.
For the second unit, go to the article MySQL 5 Stored Functions and Cursors.
You may also need: