On Monday 11 April 2005 11:01, Pierre-Frédéric Caillaud wrote: > psycopg ... has a dictfetchall() method which is worth its weight in > donuts !
It's very simple to write one for MySQLdb: def dictfetchall(cursor): '''Takes a MySQLdb cursor and returns the rows as dictionaries.''' col_names = [ d[0] for d in cursor.description ] return [ dict(zip(col_names, row)) for row in cur.fetchall() ] In truth, although postgres has more features, MySQL is probably better for someone who is just starting to use databases to develop for: the chances are higher that anyone using their code will have MySQL than Postgres, and they aren't going to need the features that Postgresql has that MySQL doesn't. IMO, this has changed since only a year or two ago, when MySQL didn't support foreign-key constraints.
pgpIeUfcyT5Ux.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list