of mappers used in polymorphic inheritance loads is sorted on class name,
which allows the SELECT statements generated for polymorphic queries
to have deterministic rendering, which in turn helps with caching
schemes that cache on the SQL string itself.
[ticket:2779]
.. changelog::
:version: 0.8.3
+ .. change::
+ :tags: bug, orm
+ :tickets: 2779
+
+ Backported a change from 0.9 whereby the iteration of a hierarchy
+ of mappers used in polymorphic inheritance loads is sorted on class name,
+ which allows the SELECT statements generated for polymorphic queries
+ to have deterministic rendering, which in turn helps with caching
+ schemes that cache on the SQL string itself.
+
.. change::
:tags: bug, orm
:tickets: 2794
while stack:
item = stack.popleft()
descendants.append(item)
- stack.extend(item._inheriting_mappers)
+ stack.extend(sorted(item._inheriting_mappers,
+ key=lambda m: m.class_.__name__))
return util.WeakSequence(descendants)
def polymorphic_iterator(self):