Re: [sqlalchemy] Setting many to many collection with secondary relationship when having only pk to one of the models.

2018-08-23 Thread Mike Bayer
On Thu, Aug 23, 2018 at 3:07 PM, Alex Rothberg wrote: > I didn't mean to confuse this question by showing both formats of the > many-to-many relationship (using secondary and not); I am aware that using > both can lead to problems / inconsistencies. > > I just wanted to show that I had both

Re: [sqlalchemy] Setting many to many collection with secondary relationship when having only pk to one of the models.

2018-08-23 Thread Alex Rothberg
I didn't mean to confuse this question by showing both formats of the many-to-many relationship (using secondary and not); I am aware that using both can lead to problems / inconsistencies. I just wanted to show that I had both options available at my disposal. Is there anyway to use the

Re: [sqlalchemy] Setting many to many collection with secondary relationship when having only pk to one of the models.

2018-08-23 Thread Mike Bayer
On Wed, Aug 22, 2018 at 5:41 PM, Alex Rothberg wrote: > I am using an association model / table to represent a many to many > relationship: > > class Geography(db.Model): > > id = > ... > > class Fund(db.Model): > id = > ... > geography_associations = db.relationship( >

[sqlalchemy] Setting many to many collection with secondary relationship when having only pk to one of the models.

2018-08-22 Thread Alex Rothberg
I am using an association model / table to represent a many to many relationship: class Geography(db.Model): id = ... class Fund(db.Model): id = ... geography_associations = db.relationship( lambda: FundGeographyAssociation, back_populates="fund",