NEWDECIMAL type in MySQL 5.0
MySQL database connector for Python programming
Brought to you by:
adustman
MySQL 5.0.16 Python 2.2:
MySQLdb doesn't know about the NEWDECIMAL type in
MySQL 5.0 and is returning them as strings. To fix
this issues
constants/FIELD_TYPE.py add:
NEWDECIMAL = 246
converters.py (conversions):
FIELD_TYPE.NEWDECIMAL: float,
Also add to this section:
try:
from decimal import Decimal
conversions[FIELD_TYPE.DECIMAL] = Decimal
conversions[FIELD_TYPE.NEWDECIMAL] = Decimal
except ImportError:
pass
A lot of things come back as decimal type with MySQL
5.0 precision math. For example doing a sum() on a
column returns a NEWDECIMAL type so this needs to be
added for MySQL 5.0 compatibility.
Thanks for your help,
Ryan Huddleston
RightNow Technologies
Logged In: YES
user_id=1455079
I ran into this problem also, while using the Django
framework. Hopefully this fix will make it into a release
soon , since webhosts are starting to adopt MySQL 5.
Logged In: YES
user_id=71372
This has been fixed in the current CVS tree.