add "deferred property" loader (half done - need 'group' + docs)

Issue #24 resolved
Mike Bayer repo owner created an issue

a lazy loader right now only applies to a second table that is related to a primary table. we need a lazy loader that applies to a subset of the columns within a single table.

when you load an object from the DB, all the columns of the table are loaded into the new object instance unconditionally. for situations where it is wasteful to load all the columns into memory every time, create a new kind of property, the "deferred column", that is not selected by default when an object is loaded. the property contains a callable which when refrenced, triggers a load of all the "deferred" columns.

as a bonus, make it so that if an object is loaded, modified, and saved, all without touching any of the "deferred" columns, they remain unloaded from the database even after save.

Comments (6)

  1. Mike Bayer reporter

    also, add mapper options for controlling this property:

    defer(colname, group=None) - passed to mapper.options to convert a column proeprty to a deferred column property. optional group indicates the group of deferred properties to be loaded simultaneouly

    undefer(colname) - passed to mapper.options to convert a deferred column property to a non-deferred column property

  2. Log in to comment