Im using Mysqldb with Python (2.7) to return a bunch of values, forms a latin1 encoded Mysql database.
The mysql database has values like bit (1), when they return, they look like this: \ x01 '
Decimal values are returned as this Decimal number ('0E-8')
The remaining values and types are in order.
Sample database:
{'test': '\ x01', 'currency': u'bla ',' balance ': Decimal (' 0E-8 '),' first ': u'John'}
Here's how im connects to the database: self.con = MySQLdb.connect (host = conn ['host'], user = conn ['user'], passwd = conn ['passwd'], db = conn ['db' ], charset = conn ['charset'], port = int (conn ['port']), if "port" in conn else 3306)
I would like bit (1) values to be returned as True or False. I looked around and think it might be MySQLdb.converters.conversions, but I'm not sure how to implement this. Any ideas would be great. Thanks
And I do not have access to changing types in the database.
source
share