Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 10:32:32 -0500 Tim Chase wrote: > Mike gave you a good answer, though I think it's MySQL specific. I don't have to deal with MySQL frequently but I've remembered that I used got the fields out somehow, and now, looking at the code, I wonder myself, why "how" is 1 and wtf is

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Tim Chase
jorma kala wrote: Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query="select * from employees" db=MySQLdb.connect(host=host,user=user,passwd=passwd,db=database) cursor = db.cursor

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Kushal Kumaran
On Fri, Jun 19, 2009 at 8:16 PM, jorma kala wrote: > Hi, > Is there a way of retrieving the value of columns in the rows returned by > fetchall, by column name instead of index on the row? > Code Snippet: > > query="select * from employees" > db=MySQLdb.connect(host=host,user=user,passwd=

Re: Retrieving column values by column name with MySQLdb

2009-06-19 Thread Mike Kazantsev
On Fri, 19 Jun 2009 15:46:46 +0100 jorma kala wrote: > Is there a way of retrieving the value of columns in the rows returned by > fetchall, by column name instead of index on the row? Try this: db = MySQLdb.Connection(host=host,user=user,passwd=passwd,db=database) db.query(query) result

Retrieving column values by column name with MySQLdb

2009-06-19 Thread jorma kala
Hi, Is there a way of retrieving the value of columns in the rows returned by fetchall, by column name instead of index on the row? Code Snippet: query="select * from employees" db=MySQLdb.connect(host=host,user=user,passwd=passwd,db=database) cursor = db.cursor () cursor.execu