[sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Benjamin Sims
Is there an obvious way to set up an association proxy so that it only returns distinct objects? For example, if I have: Post - Tag - Tag_Category and would like to access Post.Tag_Categories so that it contains each category only once. Any tips appreciated, sure I am missing something obvious

Re: [sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Michael Bayer
Since the uniqueness makes this kind of a read only thing, I'd use a plain @property: @property def unique_tags(self): return set(cat.tag for cat in self.tag_categories) On May 1, 2012, at 10:08 AM, Benjamin Sims wrote: Is there an obvious way to set up an association proxy so that it

Re: [sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Benjamin Sims
Thanks, works perfectly. On 1 May 2012 15:16, Michael Bayer mike...@zzzcomputing.com wrote: Since the uniqueness makes this kind of a read only thing, I'd use a plain @property: @property def unique_tags(self): return set(cat.tag for cat in self.tag_categories) On May 1, 2012, at