import psycopgdef dictfetchone(cur): seq = cur.fetchone() if seq == None: return seq result = {} colnum = 0 for column in cur.description: result[column[0]] = seq[colnum] colnum += 1 return resultdbh = psycopg.connect('dbname=jgoerzen user=jgoerzen')print "Connection successful."cur = dbh.cursor()cur.execute("SELECT * FROM myTable")while 1: row = dictfetchone(cur) if row == None: break print rowdbh.close()
Name (required)
email (will not be published) (required)
Website