Thanks! Yes, it is documented, and I tried to sift through the URLs before asking, but it's kind of difficult (at least for me) to understand where exactly should I be looking for a particular piece of introspection info.
From: [email protected] [mailto:[email protected]] On Behalf Of Michael Bayer Sent: Sunday, December 08, 2013 10:47 PM To: [email protected] Subject: Re: [sqlalchemy] m2m introspection with modern sqlalchemy do this: from sqlalchemy import inspect for rel in inspect(MyClass).relationships: target_class = rel.mapper.class_ this stuff is all documented, though it involves familiarizing with a few basic constructs like Mapper and RelationshipProperty: http://docs.sqlalchemy.org/en/rel_0_9/core/inspection.html?highlight=inspect #sqlalchemy.inspection http://docs.sqlalchemy.org/en/rel_0_9/orm/mapper_config.html?highlight=relat ionships#sqlalchemy.orm.mapper.Mapper.relationships http://docs.sqlalchemy.org/en/rel_0_9/orm/internals.html#sqlalchemy.orm.prop erties.RelationshipProperty.mapper http://docs.sqlalchemy.org/en/rel_0_9/orm/mapper_config.html#sqlalchemy.orm. mapper.Mapper.class_ On Dec 8, 2013, at 5:55 AM, Alexey Vihorev <[email protected]> wrote: Hi again! I can do MyClass.iterate_properties()and check if a property is m2m relationship. But how can I find out which class it references? Thanks! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to <mailto:[email protected]> [email protected]. To post to this group, send email to <mailto:[email protected]> [email protected]. Visit this group at <http://groups.google.com/group/sqlalchemy> http://groups.google.com/group/sqlalchemy. For more options, visit <https://groups.google.com/groups/opt_out> https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.
