SV: Function to convert fetchone() result from a list to a dictionary

Skip Montanaro skip at pobox.com
Tue Apr 29 09:52:41 EDT 2003


    Carsten> Hmm... Nice. However, is this MySQLdb.cursors.DictCursor
    Carsten> available in other DB modules - say, if I someday changed to
    Carsten> (shudder) Postgres or Oracle?

Yes, though in a slightly different manner.  In Psycopg (one of a couple
PostgreSQL wrappers), instead of specifying the type of cursor at database
connection time, you call a different fetch function, e.g., c.dictfetchone()
or c.dictfetchall().

Skip





More information about the Python-list mailing list