#
# reportorg.py: display organization data using dynamic queries
#
# PostgreSQL 9 version
#
from db import conn, curs, Error, pmark

#
# Column names shoud come from the cursor description
#
sql = "SELECT * FROM sponsorship_organization"
curs.execute(sql)
#
# Set COLS to the list of column names extracted from the cursor description
#
COLS = [x[0] for x in curs.description]

for row in curs.fetchall():
    print "=============="
    for name, value in zip(COLS, row):
        print "%-12s: %s" % (name, value)
