Re: getting database column names from query

2006-08-16 Thread skip
Jason> I'm using MySQLdb and can connect and issue queries that return Jason> result sets, but I how do I get the column names for those result Jason> sets? >>> c = MySQLdb.connect(*creds) >>> k = c.cursor() >>> k.execute("select * from account") 3L >>> k.fetchall

Re: getting database column names from query

2006-08-16 Thread Bob Kline
Jason Nordwick wrote: > 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? [d[0] for d in k.description] Cheers, Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: getting database column names from query

2006-08-16 Thread Simon Forman
Jason Nordwick wrote: > 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'