On May 30, 2008, at 9:27 AM, Sed wrote:
>
> Sorry for the subject, I wasn't able to find a good one.
>
> I'd like to have 2 differente attribute of python to be mapped in one
> sql column.
>
> e.g.:
>
> person_table = Table('person', metadata
> ,Column('id', Integer, primary_key=True)
> )
>
> class Person(object):
> pass
>
> and I'd like to do something like
> mapper_person=mapper(Person, person_table, properties=
> {'user_id':person_table.c.id
> ,'id':person_table.c.id}
> )
>
> how can I achieve such things ?
>
use mapper(Person, person_table,
properties={'user_id':synonym('id')}) .... there's some docs at
http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_overriding
.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---