On Wednesday, May 19, 2021 at 6:50:57 PM UTC-5 Mike Bayer wrote:

>
> It mostly depends on what people need to do.  If people have been fine 
> with the overlapping relationships and not had a problem it's not 
> necessarily a bad thing, otherwise the assoc proxy is pretty common.  But, 
> if there are no significant columns in AtoB other than the A's and B's, I'd 
> probably just go with the single many-to-many relationship.
>

Thanks. With this in mind, I think that the general mode of Django is 
pretty different from SQLAlchemy in this regard. Django users expect 
different relationships could indeed have conflicts like that, so as you 
suggest, it might be best to keep the overlapping relationships, so that 
existing flows don't break.

In the general case I'm working with, I can't know whether there are any 
additional interesting fields other than the foreign keys on the secondary 
table. In some cases there are, but in other cases there are not.

One challenge is that I generate these one model at a time. I was 
originally hoping that I could specify the overlapping relationships only 
on the many-to-many relationship and solve this case, but my attempt at 
that did not work the way I'd hoped, and you mentioned needing to add it to 
all the relationships, so I suspect that this is indeed correct. I suspect 
I will need to gather all of these conflicts before I create the 
relationships, and that it may not be possible, or would be bad form, to 
adjust existing relationships with this after they are created. Does that 
sound right?

Thanks for all your help, and for the excellent docs on these warnings. 
While I still have questions, I was able to understand quite a lot of it 
before I needed to come ask for assistance.

Ryan

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/3a4964d5-9bc5-4536-9b14-37452eaeefa6n%40googlegroups.com.

Reply via email to