declarative mixin fails with joined table inh + renamed column

Issue #1931 resolved
Mike Bayer repo owner created an issue

the same as #1930 but for joined. Declarative would need different rules to handle this.

        class MyMixin(object):
            foo = Column('foo', Integer)
            bar = Column('bar_newname', Integer)

        class General(Base, MyMixin):
            __tablename__ = 'test'
            id = Column(Integer, primary_key=True)
            type_ = Column(String(50))
            __mapper__args = {'polymorphic_on': type_}

        class Specific(General):
            __tablename__ = 'sub'
            id = Column(Integer, ForeignKey('test.id'), primary_key=True)
            __mapper_args__ = {'polymorphic_identity': 'specific'}

Comments (3)

  1. Mike Bayer reporter

    Note that the reason this raises an error is due to the change in #1896 - the mapper refuses to join together explicit column based properties from a subclass to that of a superclass, since it assumes if the user was being explicit, guesses should not be made. So declarative has to perform this joining itself. 83a87b3f5499cdd28a4e8e79f01f2f477793d560

  2. Log in to comment