[sqlalchemy] Filtering by an attribute of a related class (abusing generative filters...)

2009-02-28 Thread Ben Zealley
Hi all, I've got a requirement that seems like it should be fairly straightforward, but my own attempts to work out the necessary code have just become more and more contrived, and still don't work :( so I'm hoping someone more familiar with SQLA's design can suggest a better approach!

[sqlalchemy] Re: Filtering by an attribute of a related class (abusing generative filters...)

2009-02-28 Thread Ben Zealley
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