On Mar 27, 2010, at 12:31 PM, Chris Withers wrote: > Hi Michael, > > I read http://www.sqlalchemy.org/trac/ticket/1751 with some curiousity. > > My take on declarative mixins was that _as_declarative should basically > accumulate everything from the bases as if it were in the class itself and > then let _as_declarative behave exactly as it usually did on the resultant > attributes. > > As such, I can't see why relationships or foreign keys in columns are a bad > thing. You can have multiple classes with a relationship to a single other > class, so why not allow that relationship to be abstracted out in a mixin? > (DRY and all that...)
We can fine tune the restriction to be more about specifically what was in that ticket, i.e. BaseClass(Base) some column Mixin some column with foreign key to BaseClass.some column ActualClass(BaseClass) some column that overrides BaseClass.some column issue #1. BaseClass.some column never gets bound to a table (its copied). issue #2. Mixin.some column also never gets bound to a table (its copied). it has a foreign key pointing to another non-used column. Confusing error messages ensue. issue #3. ActualClass overides BaseClass.some column completely. Even if the copies could figure out who they really need to point to in #1 and #2, they're *still* wrong - more diviniation is needed such that BaseClass.some column figures out that its bound to a class, it descends to a subclass, etc, all of this assumes a completely different paradigm of everything. #1, #2, #3 are all about Column/ForeignKey objects which are not at all aware of any of these patterns, and I'm sure there are many variants, as well as for relationship() which currently doesn't implement the copy logic. Until we can get these cases covered, I would rather that our users don't waste their time experimenting and receiving mysterious deep failures only to realize hours/days later that none of their expectations are currently covered, hence the entire field of feature is disallowed *for now*. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.