pymysql question

MRAB python at mrabarnett.plus.com
Thu Feb 18 07:52:32 EST 2016


On 2016-02-18 12:08, tdsperth at gmail.com wrote:
> Hi All
>
> I have many mysql tables in a conversion I am doing - the table field names are a mixture of lower case and upper case - do I have to covert all to one case to over come Python not finding the field.
>
> rows ocur.fetchall()
> for row in rows:
>      print(row['newname'])
>      #which fails because it is upper case in the table
>
According to this:

MySQL query to get column names?
http://stackoverflow.com/questions/4165195/mysql-query-to-get-column-names

it's possible to get the column names.

You could then build a dict to map a lowercase column name to an actual 
column name.




More information about the Python-list mailing list