[Sqlalchemy-tickets] Issue #3956: Mutable + column properties broken (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Marcin K. <iss...@bi...> - 2017-04-04 09:27:38
|
New issue 3956: Mutable + column properties broken https://bitbucket.org/zzzeek/sqlalchemy/issues/3956/mutable-column-properties-broken Marcin Kurczewski: Trying to use both mutable and column properties within the same table results in mapper exception. The stacktrace is: ``` #!text Traceback (most recent call last): File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 682, in __getattr__ return getattr(self.comparator, key) AttributeError: 'Comparator' object has no attribute 'info' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/www/tmp.sakuya.pl/f/test", line 25, in <module> session.query(User).all() File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 1328, in query return self._query_cls(entities, self, **kwargs) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 139, in __init__ self._set_entities(entities) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 150, in _set_entities self._set_entity_selectables(self._entities) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 180, in _set_entity_selectables ent.setup_entity(*d[entity]) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3595, in setup_entity self._with_polymorphic = ext_info.with_polymorphic_mappers File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 764, in __get__ obj.__dict__[self.__name__] = result = self.fget(obj) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py", line 1948, in _with_polymorphic_mappers configure_mappers() File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py", line 2869, in configure_mappers mapper, mapper.class_) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/event/attr.py", line 218, in __call__ fn(*args, **kw) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/orm/events.py", line 616, in wrap fn(*arg, **kw) File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/ext/mutable.py", line 603, in listen_for_type prop.columns[0].info.get('_ext_mutable_orig_type') File "/home/rr-/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 688, in __getattr__ key) AttributeError: Neither 'Label' object nor 'Comparator' object has an attribute 'info' ``` The code works fine on 1.1.7 and doesn't on 1.1.8. The GitHub hash of the change that introduces this behavior is 07b63894cb8ff9529b406f196b5d7cb9af209e9e: "Track SchemaEventTarget types in as_mutable()". I attach a code sample that triggers this behavior. |