+- orm
+ - remember all that stuff about polymorphic_union ? for
+ joined table inheritance ? Funny thing...
+ You sort of don't need it for joined table inheritance, you
+ can just string all the tables together via outerjoin().
+ The UNION still applies if concrete tables are involved,
+ though (since nothing to join them on).
- sql
- long-identifier detection fixed to use > rather than >= for
max ident length [ticket:589]
return "Company %s" % self.name
-# create a union that represents both types of joins.
-person_join = polymorphic_union(
- {
- 'engineer':people.join(engineers),
- 'manager':people.join(managers),
- 'person':people.select(people.c.type=='person'),
- }, None, 'pjoin')
-
-#person_mapper = mapper(Person, people, select_table=person_join, polymorphic_on=person_join.c.type, polymorphic_identity='person')
-person_mapper = mapper(Person, people, select_table=person_join,polymorphic_on=person_join.c.type, polymorphic_identity='person')
+person_join = people.outerjoin(engineers).outerjoin(managers)
+
+person_mapper = mapper(Person, people, select_table=person_join,polymorphic_on=people.c.type, polymorphic_identity='person')
mapper(Engineer, engineers, inherits=person_mapper, polymorphic_identity='engineer')
mapper(Manager, managers, inherits=person_mapper, polymorphic_identity='manager')
result_list = selectcontext.attributes[(instance, self.key)]
if self._should_log_debug:
self.logger.debug("eagerload list instance on %s" % mapperutil.attribute_str(instance, self.key))
- self.mapper._instance(selectcontext, decorated_row, result_list)
+ self.select_mapper._instance(selectcontext, decorated_row, result_list)
finally:
selectcontext.recursion_stack.remove(self)