I'm working with a IBM DB2 database using ibm_db2 driver and sqlalchemy. My model is:
class User(Model):
id = Column('UID', Integer, primary_key=True)
user = Column('USER', String(20))
password = Column('PASSWORD', String(10))
name = Column('NAME', String(30))
String fields from the database (e.g. name) comes in the form of:
>>> "John "
, where the value is filled right with blanks to the full length of the field by schema.
I need to change this behavior to the sqlalchemy type String (or a derivative thereof) produced follow (e.g. value.strip()) before output results by query.all():
>>> "John"
How can I do this?
@property decorator is not applicable. I need to change the behavior of a standard sqlalchemy String class.