Michael, It works !!! :))
Thank you very much... Every day I play with SQLAlchemy I like it more and more... Cheers, Roger On 9/23/06, Michael Bayer <[EMAIL PROTECTED]> wrote: > you should try a custom Boolean type: > > from sqlalchemy import types > > class MyBoolean(types.TypeDecorator): > impl = types.Boolean > def convert_result_value(self, value, dialect): > if value is None: > return None > elif value == 'S': > return True > elif value == 'N': > return False > else: > raise "invalid value %s" % value > def convert_bind_param(self, value, dialect): > if value: > return 'S' > else: > return 'N' > > customer_table = Table('customer', metadata, > Column('active', MyBoolean), > autoload=True) > > > On Sep 23, 2006, at 2:37 PM, Roger Demetrescu wrote: > > > Hi folks, > > > > I have several tables with string columns (actually they are char[1] > > columns) which represent boolean values: > > > > 'S' means True > > 'N' means False > > > > So, when I do : > > > >>>> customer_table = Table('customer', metadata, autoload=True) > >>>> class Cliente(object): pass > >>>> c = session.query(Customer).get(999) > >>>> c.active > > 'S' > > > > Where I wished the last sentence has returned True. > > > > Is it possible to change columns type (and representation values) when > > mapping my classes ? > > > > I have already tried to do something like: > > > >>>> customer_table = Table('customer', metadata, > >>>> Column('active', Boolean), > >>>> autoload=True) > > > > but have no sucess... :( > > > > > > Thanks > > > > Roger > > > > ---------------------------------------------------------------------- > > --- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to > > share your > > opinions on IT & business topics through brief surveys -- and earn > > cash > > http://www.techsay.com/default.php? > > page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Sqlalchemy-users mailing list > > Sqlalchemy-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users