at http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative/mixins.html#combining-table-mapper-arguments-from-multiple-mixins we document invoking
__table_args__ from a mixin. if
@declared_attr is used we get a warning:
from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declared_attr Base = declarative_base() class Mixin(object): a = Column(Integer) @declared_attr def __table_args__(cls): return (UniqueConstraint("a"), ) class Baz(Base, Mixin): __tablename__ = 'baz' id = Column(Integer, primary_key=True) d = Column(Integer) @declared_attr def __table_args__(cls): ret = list(Mixin.__table_args__) ret.append(UniqueConstraint("d")) return tuple(ret)
SAWarning: Unmanaged access of declarative attribute __table_args__ from non-mapped class Mixin
the thing we're guarding against here is the case in https://bitbucket.org/zzzeek/sqlalchemy/issues/3149/mixin_column-to-provide-more-context-for, which is already prevented here.
not clear what additional case we are guarding against here however we could also limit the warning only for names that aren't