MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _create_eager_adapter

Method _create_eager_adapter

lib/sqlalchemy/orm/strategies.py:2774–2808  ·  view source on GitHub ↗
(self, context, result, adapter, path, loadopt)

Source from the content-addressed store, hash-verified

2772 )
2773
2774 def _create_eager_adapter(self, context, result, adapter, path, loadopt):
2775 compile_state = context.compile_state
2776
2777 user_defined_adapter = (
2778 self._init_user_defined_eager_proc(
2779 loadopt, compile_state, context.attributes
2780 )
2781 if loadopt
2782 else False
2783 )
2784
2785 if user_defined_adapter is not False:
2786 decorator = user_defined_adapter
2787 # user defined eagerloads are part of the "primary"
2788 # portion of the load.
2789 # the adapters applied to the Query should be honored.
2790 if compile_state.compound_eager_adapter and decorator:
2791 decorator = decorator.wrap(
2792 compile_state.compound_eager_adapter
2793 )
2794 elif compile_state.compound_eager_adapter:
2795 decorator = compile_state.compound_eager_adapter
2796 else:
2797 decorator = path.get(
2798 compile_state.attributes, "eager_row_processor"
2799 )
2800 if decorator is None:
2801 return False
2802
2803 if self.mapper._result_has_identity_key(result, decorator):
2804 return decorator
2805 else:
2806 # no identity key - don't return a row
2807 # processor, will cause a degrade to lazy
2808 return False
2809
2810 def create_row_processor(
2811 self,

Callers 1

create_row_processorMethod · 0.95

Calls 4

wrapMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected