[Sqlalchemy-tickets] [sqlalchemy] #1018: Polymorphic relationships fail in a concrete table inherit
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2008-04-29 10:06:16
|
#1018: Polymorphic relationships fail in a concrete table inheritance scenario --------------------+------------------------------------------------------- Reporter: ged | Owner: zzzeek Type: defect | Status: new Priority: medium | Milestone: Component: orm | Severity: no triage selected yet Keywords: | Status_field: awaiting triage --------------------+------------------------------------------------------- See attached test case (which is a modified version of test/orm/inheritance/concrete.py). Here is the traceback. {{{ File "/home/ged/concrete_with_relations.py", line 188, in test_relation_2 res = session.query(Company).one().engineers File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/query.py", line 921, in one ret = list(self[0:2]) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/query.py", line 985, in iterate_instances rows = [process[0](context, row) for row in fetch] File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/query.py", line 1543, in main extension=context.extension, only_load_props=context.only_load_props, refresh_instance=context.refresh_instance File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1435, in _instance self.populate_instance(context, instance, row, only_load_props=only_load_props, instancekey=identitykey, isnew=isnew) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1500, in populate_instance selectcontext.exec_with_path(self, key, populator, instance, row, ispostselect=ispostselect, isnew=isnew, **flags) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/query.py", line 1664, in exec_with_path return fn(*args, **kwargs) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/strategies.py", line 622, in execute self.mapper._instance(selectcontext, decorated_row, result_list) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1359, in _instance return mapper._instance(context, row, result=result, polymorphic_from=self) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1435, in _instance self.populate_instance(context, instance, row, only_load_props=only_load_props, instancekey=identitykey, isnew=isnew) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1484, in populate_instance poly_select_loader = self._get_poly_select_loader(selectcontext, row) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1522, in _get_poly_select_loader cond, param_names = self._deferred_inheritance_condition(hosted_mapper, needs_tables) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py", line 1587, in _deferred_inheritance_condition allconds.append(visitors.traverse(mapper.inherit_condition, clone=True, visit_binary=visit_binary)) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py", line 181, in traverse return vis.traverse(clause, clone=clone) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py", line 73, in traverse return self._cloned_traversal(obj) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py", line 108, in _cloned_traversal return self._cloned_traversal_impl(obj, util.Set(stop_on), {}, _clone_toplevel=True) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py", line 115, in _cloned_traversal_impl elem = self._clone_element(elem, stop_on, cloned) File "/home/ged/devel/sqlalchemy/trunk/lib/sqlalchemy/sql/visitors.py", line 101, in _clone_element cloned[elem] = elem._clone() AttributeError: 'NoneType' object has no attribute '_clone' }}} -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1018> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |