[sqlalchemy] Re: Auto filter a relationship?

2015-09-24 Thread Jonathan Vanasco
I hit send early. That form should/will work for reading - i use it heavily. I'm not sure how/if it will interact with the collections management system (backref/backpopulates, etc). -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To

Re: [sqlalchemy] Re: Auto filter a relationship?

2015-09-24 Thread Shawn Adams
Jonathan, Are you suggesting I use this instead of the association_proxy on Reservation? Doing so will not let me have duplicate packages in the collections list. sqa filters them out. To get around that I had to use the association_proxy. On Thu, Sep 24, 2015 at 1:37 PM, Jonathan Vanasco

Re: [sqlalchemy] Re: Auto filter a relationship?

2015-09-24 Thread Jonathan Vanasco
Your use of association_proxy seems odd to me. That plugin is normally used to "cut out" the middleman when using a join with an association pattern and avoid a hop/remount a relationship from one object onto another. With my understanding and use of that plugin, you're basically setting the

[sqlalchemy] Re: Auto filter a relationship?

2015-09-24 Thread Jonathan Vanasco
packages = sa.orm.relationship("Package", primaryjoin="and_(ReservationPackage.package_id==Package.id, Package.deleted IS NOT NULL)") -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails

Re: [sqlalchemy] Re: Auto filter a relationship?

2015-09-24 Thread Shawn Adams
Reservation -> packages is just a many-to-many relationship with the caveat that a reservation can have the same package more than once. Sqlalchemy will automatically dedube the packages collections which is not what I want. In order to avoid this I had to use reservation_packages as an