mappers and relations do late-compilation

Issue #194 resolved
Mike Bayer repo owner created an issue

the mapper() and relation() functions should create Mapper and MapperProperty objects that are "un-compiled"; all the initialization stuff that happens in Mapper's constructor should be moved to a set of compile() methods, which only get called when the mappers are first used. this is similar to how EagerLoader defers its create_eager_chain() operation until first setup(). all PropertyLoader setup operations, like the eager chain as well as backrefs etc would also go into the compile() step.

this way, we get a whole lot of stuff people have wanted; you can make mappers against class objects alone, in any order, and theyll work it out when its time to compile everything; the constructors to Mapper, MapperProperty and subclasses will become very simple and the rudimentary composed structure they create will be easy to understand (although compilation could complicate it when it runs); inheriting mappers have a chance to work out their polymorphic queries automatically (this is the original motivation behind this enhancement).

Comments (2)

  1. Log in to comment