MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / enable_eagerloads

Method enable_eagerloads

lib/sqlalchemy/orm/query.py:876–892  ·  view source on GitHub ↗

Control whether or not eager joins and subqueries are rendered. When set to False, the returned Query will not render eager joins regardless of :func:`~sqlalchemy.orm.joinedload`, :func:`~sqlalchemy.orm.subqueryload` options or mapper-level ``lazy='joined'``/

(self, value: bool)

Source from the content-addressed store, hash-verified

874
875 @_generative
876 def enable_eagerloads(self, value: bool) -> Self:
877 """Control whether or not eager joins and subqueries are
878 rendered.
879
880 When set to False, the returned Query will not render
881 eager joins regardless of :func:`~sqlalchemy.orm.joinedload`,
882 :func:`~sqlalchemy.orm.subqueryload` options
883 or mapper-level ``lazy='joined'``/``lazy='subquery'``
884 configurations.
885
886 This is used primarily when nesting the Query's
887 statement into a subquery or other
888 selectable, or when using :meth:`_query.Query.yield_per`.
889
890 """
891 self._compile_options += {"_enable_eagerloads": value}
892 return self
893
894 @_generative
895 def _with_compile_options(self, **opt: Any) -> Self:

Callers 12

subqueryMethod · 0.95
cteMethod · 0.95
labelMethod · 0.95
scalar_subqueryMethod · 0.95
existsMethod · 0.95
_values_no_warnMethod · 0.80
countMethod · 0.80
__init__Method · 0.80
test_query_oneMethod · 0.80
goMethod · 0.80

Calls

no outgoing calls

Tested by 4

test_query_oneMethod · 0.64
goMethod · 0.64