getting database column names from query

Jason Nordwick jason at adapt.com
Wed Aug 16 15:28:44 EDT 2006


I'm using MySQLdb and can connect and issue queries that return result sets, but I how do I get the column names for those result sets?

>>> c = MySQLdb.connect(*creds)
>>> k = c.cursor()
>>> k.execute("select * from account")
3L
>>> k.fetchall()
((1L, 'test', -1L), (2L, 'Test', -1L), (3L, 'Test2', -1L))


-j




More information about the Python-list mailing list