On Mon, 2010-05-24 at 10:51 +0200, Stefano Fontanelli wrote:
> On Thu, 2010-05-20 at 19:15 +0200, Stefano Fontanelli wrote:
> > 
> > In my code I need to introspect the above objects, here an example:
> > 
> > for property in Account.mapper.iterate_properties:
> >     if type(property) == RelationProperty:
> >         print property.key, property.direction.name
> > 
> > 
> > Here the output:
> > 
> > owner MANYTOONE
> > groups MANYTOMANY
> > roles MANYTOMANY
> > children ONETOMANY
> > setting ONETOMANY
> 
> I read the SQLA docs.
> http://www.sqlalchemy.org/docs/mappers.html?highlight=direction%
> 20name#one-to-one
> 
> Then I understood the rationale behind this behaviour :-)
> How can I check relation types?

In the same way you did, but also taking "property.uselist" into
account.

Hope it helps,
Gaëtan.


-- 
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en.

Reply via email to