Hi there :). Running into a bit of trouble trying to grasp how to manipulate association objects properly.
I've really got two separate questions, but hopefully it's clear enough that I can ask them both properly. Given the following example: class Event(Base): name = Column(Unicode, primary_key=True) date = Column(Date) locations = association_proxy("location_occurences", "location") class Location(Base): address = Column(Unicode, primary_key=True) events = association_proxy("event_occurences", "event") class EventOccurence(Base): event_name = Column(Unicode, ForeignKey("event.name")) address = Column(Unicode, ForeignKey("location.address")) successful = Column(Boolean) event = relationship(Event, backref=backref( "location_occurences", cascade="all, delete-orphan", lazy="dynamic" ), ) location = relationship(Location, backref=backref( "event_occurences", cascade="all, delete-orphan", lazy="dynamic" ), ) So, when searching, I see some results that seem to ask this question, though none of the solutions are for recent versions of sqlalchemy, so, I may as well just ask :): how could I have Location.events be order_by'd via Event.date? Secondly, I haven't been able to find an answer for this, but, I see that you can configure the association_proxy to use a dict-like structure, but it's always keyed by some other unique column on the association object. Example: http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html#simplifying-association-objects But how could I use the actual other *model* as the key and another column on the association object as the value. To make it clearer, I'd like: >>> some_location.events {<Event: Gala Ball> : True, <Event: Other Thing> : False} >>> some_location["New Event"] = False >>> some_location.events {..., <Event: New Event> : False} Where the values are the `successful` column on the association object, and the (hypothetical) creator used the event objects as the keys, not as the example on that page uses them as the values. Thanks, sorry for being wordy :), Julian -- 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.