On Feb 28, 2009, at 12:26 PM, Ben Zealley wrote:
> > Hi Michael, > > Thanks for the quick response! > > I had no luck with has()/any() mostly because I didn't have the > attribute per se, just its (string) name - but I've rather belatedly > realised I can just use modelClass.__dict__[attr].any(), which works > like a charm. > > I'll consider the functional approach you suggested, it does look much > cleaner - thanks for the tip. > > A related question; I'm sure there must be a straightforward way, > given an attribute 'attr' (which is a relation) of a mapped class > 'Foo', to extract a reference to the mapped class to which the > relation points. I currently have the following: > > tC = orm.class_mapper(Foo).get_property(attr)._get_target().class_ id say Foo.someattr.property.mapper.class_ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---