don't use the MONEY type in PostgreSQL, use NUMERIC instead.

On 12/27/2011 20:39, dgardner wrote:
Quick hack, figured I would share since there seemed to be other
people asking about it.

I couldn't get it to work with "autoload=True" for table reflection.

---

from sqlalchemy import types
from decimal import Decimal

class Money(types.UserDefinedType):

     def get_col_spec(self):
         return 'money'

     def result_processor(self, dialect, coltype):
         def process(value):
             # Strip off the currency symbol
             return Decimal(value[1:])
         return process


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to