On Aug 29, 2012, at 7:56 AM, Frank Hempel wrote: > Hello, > > the requirement to have multiple identical relations in a > Many-To-Many-Relationship may sound a bit absurd, however, I'm wondering how > I could do that with SA.
OK, you mean, "duplicate rows in the association table". > In principle this should work in the way that the association table would > have multiple identical rows for such a case. A "straight-forward" > many-to-many-reference-example shows that SA kind of strips such doubles out. > I already played a bit with some kwargs of the relation-function but with no > success. its not something relationship() is likely going to support. relationship() considers rows in the "secondary" table to be unique and ideally you'd have declared both FK columns as primary keys as well. All the mechanics of relationship loading and persisting work on the assumption that instances are unique in their collections - this follows from how relational schemas function. For example, with such a schema, it is completely impossible to remove just a single element from such a collection, without removing all the dupes (what would the DELETE statement be otherwise ?) . Joined eager loading would also be impossible to implement as it relies upon deduplication of rows. To even support this function in a half-broken way would be an enormous undertaking and probably have other show-stopping issues along the way that would further reduce it's feasability. -- 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.