My goal was the second one. I did try to use SynonymProperty, but got
confused about it.

Now with the correct use of synonym() it's all working!

Thanks!

On Oct 2, 10:38 am, [EMAIL PROTECTED] wrote:
> u want to have one USerName pointing to username, or u want both,
> pointing to same column?
> first is done by changing key in the mapper.properties dict.
> the other... synonim()?
>
> On Thursday 02 October 2008 16:41:05 Cleber wrote:
>
> > Hi there,
>
> > Sorry if this has come before, but I did not manage to find a
> > specific answer on the mailing list archives.
>
> > I'm porting an application to SA, and because of legacy code, I
> > need to maintain "nicknames" (for now) for some attribute names.
> > The database structure itself has column names such as "username",
> > but the legacy code refers to "UserName" properties.
>
> > users_table = \
> >     Table('users', metadata,
> >           Column('id', Integer, primary_key=True),
> >           Column('username', String(255), unique=True,
> > nullable=False),
> >      ...
>
> > I did get the two properties names, username and UserName, to point
> > to the same database column, by using multiple column_property
> > entries in my mapper:
>
> > mapper(object, table,
> >                properties = {
> >                 'UserName' : column_property((table.c.username +
> > "")), }
>
> > Note the use of an expression (table.c.username + "") which is,
> > IMHO, an ugly hack. If I don't do that, I get a 'UserName' property
> > that overwrites the 'username' property.
>
> > Am I missing the *one obvious way to do it* ?
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to