Thank you Benjamin for your answer. I will test this after the
weekend.

Torsten

On 23 Mrz., 21:57, Benjamin Trofatter <bentrofat...@gmail.com> wrote:
> I don't know if this is the canonical way of doing things, but you can
> accomplish what you're asking with the following:
>
> from sqlalchemy.orm import class_mapper
>
> parent_class = class_mapper(c2).get_property('parent').mapper.class_
>
> 2012/3/23 Torsten Irländer <torsten.irlaen...@googlemail.com>
>
>
>
>
>
>
>
> > Hi all,
>
> > Lets say i have two tables t1 and t2 which have a 1:n relationship and
> > are mapped to the classes c1 and c2.
> > c2.parent is an FK to PK c1.id. This is quite forward and works like a
> > charm.
>
> > What i want is to get information about relations to other classes
> > from within the mapped classes.
> > More precisely I'm interested in getting information about which class
> > is mapped in field c2.parent from with in the class c2. Ideally this
> > is not only the name of the class but the class itself.
>
> > Is this possible?
> > Any help on this is highly appreciated.
>
> > --
> > 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.

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