Mixin drops column uniqueness (because Column.copy omits it)

Issue #1829 resolved
Former user created an issue

If I do this:

class MyMixin(object):
    id = Column(Integer, primary_key=True)
    value = Column(String, unique=True)

class MyModel(Base, MyMixin):
    __tablename__ = 'test'

then MyModel.__table__.c.value.unique is false — the column uniqueness specified by the mixin is silently dropped. This is because Column.copy omits that attribute.

Attaching patch that fixes this, with tests. Breaks no tests.

Comments (6)

  1. Mike Bayer repo owner

    gah ! thanks, needs a test in test_metadata.py/MetaDataTest, that's where the copy() stuff goes

  2. Log in to comment