MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / create_row_processor

Method create_row_processor

lib/sqlalchemy/orm/strategies.py:3093–3178  ·  view source on GitHub ↗
(
        self,
        context,
        query_entity,
        path,
        loadopt,
        mapper,
        result,
        adapter,
        populators,
    )

Source from the content-addressed store, hash-verified

3091 ).init_class_attribute(mapper)
3092
3093 def create_row_processor(
3094 self,
3095 context,
3096 query_entity,
3097 path,
3098 loadopt,
3099 mapper,
3100 result,
3101 adapter,
3102 populators,
3103 ):
3104 if context.refresh_state:
3105 return self._immediateload_create_row_processor(
3106 context,
3107 query_entity,
3108 path,
3109 loadopt,
3110 mapper,
3111 result,
3112 adapter,
3113 populators,
3114 )
3115
3116 (
3117 effective_path,
3118 run_loader,
3119 execution_options,
3120 recursion_depth,
3121 ) = self._setup_for_recursion(
3122 context, path, loadopt, join_depth=self.join_depth
3123 )
3124
3125 if not run_loader:
3126 return
3127
3128 if not context.compile_state.compile_options._enable_eagerloads:
3129 return
3130
3131 if not self.parent.class_manager[self.key].impl.supports_population:
3132 raise sa_exc.InvalidRequestError(
3133 "'%s' does not support object "
3134 "population - eager loading cannot be applied." % self
3135 )
3136
3137 # a little dance here as the "path" is still something that only
3138 # semi-tracks the exact series of things we are loading, still not
3139 # telling us about with_polymorphic() and stuff like that when it's at
3140 # the root.. the initial MapperEntity is more accurate for this case.
3141 if len(path) == 1:
3142 if not orm_util._entity_isa(query_entity.entity_zero, self.parent):
3143 return
3144 elif not orm_util._entity_isa(
3145 path[-1], self.parent
3146 ) and not self.parent.isa(path[-1].mapper):
3147 # second check accommodates a polymorphic entity where
3148 # the path has been normalized to the base mapper but
3149 # self.parent is a subclass mapper, e.g.
3150 # joinedload(A.b.of_type(poly)).selectinload(poly.Sub.rel)

Callers

nothing calls this directly

Calls 6

inspectFunction · 0.90
_setup_for_recursionMethod · 0.80
isaMethod · 0.80
callable_for_pathMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected