Hey Guys, i have a basic question about TypeDecorator (i'm new to SA so forgive me if this question is trivial). i have this bit of code, parts of which are extracted from the sa docs) :
######################### import os from sqlalchemy import types from sqlalchemy import create_engine, Column, Integer, String, ForeignKey from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base class MyType(types.TypeDecorator): '''Copied from sa docs ''' impl = types.Unicode def process_bind_param(self, value, dialect): print "...process_bind_param" return "PREFIX:" + value def process_result_value(self, value, dialect): print "...process_result_value" return value # return value[7:] def copy(self): print "...copy" return MyType(self.impl.length) Base = declarative_base() class TestBase(Base): __tablename__ = "testbase" id = Column("id", types.Integer, primary_key=True) file = Column("file", MyType, nullable = False ) if __name__ == '__main__': engine = create_engine('sqlite://', echo=False) Base.metadata.create_all(engine) session = sessionmaker(engine)() b = TestBase(file=u"value") session.commit() print b.file ########################## I would have expected to see the print "...process_bind_param" to take action when assigning the value to "file", but it does not happen. Can anybody see what i am doing wrong? Thanks ! STefano -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.