have InstanceState skip unpicklable and/or unnecessary MapperOptions

Issue #1553 resolved
Mike Bayer repo owner created an issue

contains_eager() produces an EagerLazyOption as well as a LoadEagerFromAliasOption. contains_eager() is only relevant towards the immediate load and does not need to be sent along within InstanceState.load_options. LoadEagerFromnAliasOption is frequently not pickleable due to the alias, table, and sometimes annotated column objects within.

Every MapperOption should have a flag indicating whether it's appropriate to carry along into the options for a lazyload, and the flag should only be set for the standalone EagerLazyOption specified by lazyload(), eagerload(), as well as the DeferredOption. It should be off for EagerLazyOption sent along by contains_eager() as well as for LoadEagerFromAliasOption.

tests should include direct checks as well as checking for pickle-ability. should likey be within test/orm/test_mapper.py.

Comments (2)

  1. Log in to comment