There are also python modules that map objects to databases (Object Relational Mappers, ORMs). The two I know are
SQLObject, and
SQLAlchemy. They both work with multiple databases on the back end (MySQL, PostgreSQL, etc.), and they handle all the SQL querying for you. You just define your classes and off you go. I have used SQLObject in turbogears, and it was pretty cool. I believe they also have the option to create hand tuned queries if you wish to increase performance.