On Wednesday, January 12, 2011, Michael Bayer <[email protected]> wrote:
> The name of the property from the mapper perspective is "name".  That's the 
> contract of declarative:
>
> class MyClass(some_declarative_base):
>      __tablename__ = 'j'
>      x = Column(Integer, key='z')
>      y = Column('p', Integer, key='w')
>
> ==
>
> t = Table('j', metadata,
>         Column('x', Integer, key='z'),
>         Column('p', Integer, key='w')
> )
>
> mapper(MyClass, t, properties={
>    'x':t.c.z,
>    'y':t.c.w
> })
>
> if you were just using mapper(), then Column.key is what specifies the 
> attribute names in the mapping.
>
> To go from "name_key", you could say 
> class_mapper(MyClass)._columntoproperty[t.c.name_key].


It's now clear. Thanks a lot.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com

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

Reply via email to