Thanks Michael, I'll try that out and get back to you. I managed to solve it a bit from moving from mysqlconnector to mysqldb as the underlying db connector. They both handle data types conversion slightly differently (sigh...).
On Thursday, May 29, 2014 4:57:03 PM UTC+1, Michael Bayer wrote: > > > On May 29, 2014, at 8:26 AM, Michael Bennett <mic...@strukt.org > <javascript:>> wrote: > > > > > How do I register new types to the engine to do this translation > automagically? Coming from a java background and using hibernate and > explicit mapping annotations you can wire in similar things to a > TypeDecorator but I'm unsure how to do that when you are using the automap > features. > > Yes you’d use TypeDecorator. If you are using reflection to get at types, > then you can use the column_reflect event to intercept: > > > http://docs.sqlalchemy.org/en/rel_0_9/core/events.html?highlight=column_reflect#sqlalchemy.events.DDLEvents.column_reflect > > (note I’m fixing some of the layout on the website and I just noticed > that anchor links are still breaking on these, just scroll up a bit) > > from sqlalchemy import event, Table, Numeric > > @event.listens_for(Table, “column_reflect”) > def listen(insp, table, column_info): > if isinstance(column_info[‘type’], Numeric): > column_info[‘type’] = MyDecoratorNumeric(column_info[’type’]) > > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.