eager loading overhaul

Issue #68 resolved
Mike Bayer repo owner created an issue

eager loading continues to be subject to gotchas, still doenst detect "circular" eager loads if you make an eager load mapper, with a property, with ia backref on that property, then eagerload that backref, i.e.

Place._mapper = mapper(Place, place)
Transition.mapper = mapper(Transition, transition, properties = dict(
   inputs = relation(Place._mapper, input_arc, lazy=False, backref='outputs'),
   )
)

Place.mapper = Place._mapper.options(
    eagerload('outputs')
)

loading from Place.mapper will descend into Transition's mapper back to Places again, and even with aliases turned on in the relations it still puts the tables into the join criterion too many times and the query breaks. EagerLoader code is also sprawling at this point.

so we are going to simplify again, have eagerloader just aliasize all of its criterion every time to simplify a lot of the "alias" gymnastics, and upon init create its own "chain" of eager loaders, it will build them all from scratch each time to avoid conflicts with other eager loaders, and will detect cycles via the primary class or table being mapped to, and at the point of circular create a lazyloader to break the cycle.

so, we will no longer need 'use_alias', we will no longer raise an exception if a 'cycle' is detected. it will just work the first time in all cases.

Comments (1)

  1. Log in to comment