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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---