get eager loads to work with polymorphic mappers; get FetchModeOption to work

Issue #917 resolved
Mike Bayer repo owner created an issue

defect because query.join() is broken when using a complex select_table such as an aliased UNION. new test suite should be test/orm/inheritance/query.py, use the person/engineer/manager/boss/company mapping with the pjoin UNION. this change would remove __surrogate_mapper altogether. adapt_criterion should not take effect when a regular outerjoin-based select_table is used. ideas attached.

Comments (3)

  1. Mike Bayer reporter

    work within the branch reveals that the surrogate mapper is quite useful, and should be kept around; all the heavy lifting to identify the mapped tables "primary key" as well as having a translated version of each column present otherwise has to be done on an ad-hoc basis within Query with more complexity and overhead. Also, eager loaders need to chain to a select_table mapper, then to more eager loaders, then to more select_table mappers, etc. so Query isn't involved in that chain; therefore the work needs to be within EagerLoader, and it basically involves eager loaders looking at the parent table and adding more aliasing in to the PropertyAliasedClauses object, which will also need some extra options to handle this scenario.

    This means that we will have to keep a little bit of conditional logic around in Query that aliases things either against the select_from() argument or against the polymorphic select_table attribute the way we do now, but the aliasing for select_from() should be cleaned up and made against a one-time AliasedClauses.

    after we clean up how select_mapper is used, get FetchModeOption to work too so that its all configurable.

  2. Log in to comment