I would like a general way to generate column labels directly from the selected column names, and recall seeing that python\'s psycopg2 module supports this feature.
I also used to face similar issue. I use a simple trick to solve this. Suppose you have column names in a list like
col_name = ['a', 'b', 'c']
Then you can do following
for row in cursor.fetchone(): print zip(col_name, row)