Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-19 Thread jens . troeger
Thank you, that worked. Alas, I might have to use an explicit association object after all if I want to set the *is_manager* value in the association table. Simply assigning a new User to the Team.managers l

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-15 Thread Simon King
Actually I think in this case you could probably leave the "secondary" argument as the association table itself, but change the join condition via the "primaryjoin" parameter. Something like this (completely untested): class User(Base): id = Column(Integer, primary_key=True) managed_teams

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-15 Thread jens . troeger
Thanks Simon. While this seems to have worked, I only run into the next error. Mind you, I’m somewhat new to Alchemy and my SQL is rather rusty at the moment. My current approach managed_teams = relationship("Team",

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-15 Thread Simon King
Table objects put columns under the ".c" attribute, so you probably need "user_team_association.c.is_manager". Simon On Thu, Jun 15, 2017 at 12:11 AM, wrote: > Thank you Mike, the composite joins look like something close to what I > need. However, it seems that they too require a mapped class

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-14 Thread jens . troeger
Thank you Mike, the composite joins look like something close to what I need. However, it seems that they too require a mapped class for the association table? I tried managed_teams = relationship("Team",

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-14 Thread jens . troeger
Thank you Mike, the composite joins look like something close to what I need. However, it seems that they too require a mapped class for the association table? I tried managed_teams = relationship("Team",

Re: [sqlalchemy] Adding filters to association (secondary) relationships

2017-06-14 Thread mike bayer
On 06/14/2017 04:54 PM, jens.troe...@gmail.com wrote: Hello, I’ve been thinking about modeling an /attributed/ many-to-many relationship for a few days now, and can’t find a solution that I liked. Somehow association objects feel clumsy because I really would like to avoid creating a class

[sqlalchemy] Adding filters to association (secondary) relationships

2017-06-14 Thread jens . troeger
Hello, I’ve been thinking about modeling an *attributed* many-to-many relationship for a few days now, and can’t find a solution that I liked. Somehow association objects feel clumsy because I really would like to avoid creating a class for that association. See more details in this Stackoverf