the @validates decorator will modify values on the way in:

http://www.sqlalchemy.org/docs/05/mappers.html#simple-validators

if you're looking for upper case at the SQL expression level then you  
need to build a comparator.  but you can send that to column_property:

name = column_property(Column('name', String),  
comparator_factory=MyComparator)


On Apr 30, 2009, at 3:38 PM, Sneaky Wombat wrote:

>
> What's the best way to force upper case on a column?  I see the
> following in the tutorial/documentation...
>
> class MyClass(Base):
>    __tablename__ = 'sometable'
>
>    name = Column('name', String)
>
>    @comparable_using(MyUpperCaseComparator)
>    @property
>    def uc_name(self):
>        return self.name.upper()
>
> Is that the best way? Using decorators?  It'd be nice to be able to
> specify keywords in the Column() call.
>
> >


--~--~---------~--~----~------------~-------~--~----~
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