Retrieving column values by column name with MySQLdb
jjkk73 at gmail.com
Fri Jun 19 10:46:46 EDT 2009
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?
query="select * from employees"
cursor = db.cursor ()
rows = cursor.fetchall ()
for row in rows:
Instead of specifying the index of the row to retrieve the first column
(row), I'd like to retrieve the value of the first column by column name.
Something like row.get('employee_id')
Is something of the sort possible with Mysqdb?
Thanks very much.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list