[sqlalchemy] select distinct on a relation to an entity with composite primary key

2011-01-20 Thread NiL
hi list, I have the following (elixir) definitions class Invoice(Entity): user_name = Field(Unicode(255)) item = ManyToOne(Item) class Item(Entity): item_id = Field(Integer, primary_key=True) service_id = Field(Unicode(255), primary_key=True) item_class =

Re: [sqlalchemy] select distinct on a relation to an entity with composite primary key

2011-01-20 Thread Michael Bayer
its a little unfortunate that Invoice.item.distinct() is recursion overflowing like that, but in general if you want to select distinct Item objects you'd be saying query(Item).distinct(). not sure I understand what invoices that have distinct items means. I understand invoices that have