consistency between @declared_attr and plain column with joined inh

Issue #2565 resolved
Mike Bayer repo owner created an issue

the original behavior given to the "column copy" behavior in mixins doesn't match what's become of the @declared_attr use case. these should probably act the same.

        class Mixin(object):
            a = Column(Integer)

            @declared_attr
            def b(cls):
                return Column(Integer)

        class A(Mixin, Base):
            __tablename__ = 'a'
            id = Column(Integer, primary_key=True)

        class B(A):
            __tablename__ = 'b'
            id = Column(Integer, ForeignKey('a.id'), primary_key=True)

        assert 'a' in A.__table__.c
        assert 'b' in A.__table__.c
        assert 'a' not in B.__table__.c
        assert 'b' not in B.__table__.c

Comments (2)

  1. Log in to comment