Mutable + column properties broken
Trying to use both mutable and column properties within the same table results in mapper exception.
The stacktrace is:
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.
Comments (5)
-
reporter -
repo owner unfortunately this is a regression since 1.1.8 due to
#3950 -
repo owner -
repo owner - changed status to resolved
Ensure we check that SQL expression has an .info attribute
Fixed regression released in 1.1.8 due to
3950
where the deeper search for information about column types in the case of a "schema type" or a :class:.TypeDecorator
would produce an attribute error if the mapping also contained a :obj:.column_property
.Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931 Fixes:
#3956→ <<cset d13734add349>>
-
repo owner Ensure we check that SQL expression has an .info attribute
Fixed regression released in 1.1.8 due to
3950
where the deeper search for information about column types in the case of a "schema type" or a :class:.TypeDecorator
would produce an attribute error if the mapping also contained a :obj:.column_property
.Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931 Fixes:
#3956(cherry picked from commit d13734add349ec6763cce8b194806c5afe988000)→ <<cset 1ad5ad165d35>>
- Log in to comment
(Removing either the
things
property or thefull_name
property alleviates the error.)