[Sqlalchemy-tickets] Issue #3778: Mapper property all_orm_descriptors memoized even after new attri
Brought to you by:
zzzeek
From: Konsta V. <iss...@bi...> - 2016-08-20 16:07:35
|
New issue 3778: Mapper property all_orm_descriptors memoized even after new attributes get added https://bitbucket.org/zzzeek/sqlalchemy/issues/3778/mapper-property-all_orm_descriptors Konsta Vesterinen: The following code should outline the issue: ``` #!python import sqlalchemy as sa from sqlalchemy.ext.declarative import declarative_base, synonym_for Base = declarative_base() class Article(Base): __tablename__ = 'article' id = sa.Column(sa.Integer, primary_key=True) Article.__mapper__.all_orm_descriptors Article.name = sa.Column(sa.String) Article.__mapper__.all_orm_descriptors.keys() ``` I would expect the last line to return a list containing ``'name'``, but currently it only returns ``['id', '__mapper__']``. Even calling ``sa.orm.configure_mappers()`` won't help here. I noticed this problem when I had SQLAlchemy mapper configuration listeners that were accessing ``Mapper.all_orm_descriptors``. |