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

Method create_row_processor

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

Source from the content-addressed store, hash-verified

1977 return q
1978
1979 def create_row_processor(
1980 self,
1981 context,
1982 query_entity,
1983 path,
1984 loadopt,
1985 mapper,
1986 result,
1987 adapter,
1988 populators,
1989 ):
1990 if (
1991 loadopt
1992 and context.compile_state.statement is not None
1993 and context.compile_state.statement.is_dml
1994 ):
1995 util.warn_deprecated(
1996 "The subqueryload loader option is not compatible with DML "
1997 "statements such as INSERT, UPDATE. Only SELECT may be used."
1998 "This warning will become an exception in a future release.",
1999 "2.0",
2000 )
2001
2002 if context.refresh_state:
2003 return self._immediateload_create_row_processor(
2004 context,
2005 query_entity,
2006 path,
2007 loadopt,
2008 mapper,
2009 result,
2010 adapter,
2011 populators,
2012 )
2013
2014 _, run_loader, _, _ = self._setup_for_recursion(
2015 context, path, loadopt, self.join_depth
2016 )
2017 if not run_loader:
2018 return
2019
2020 if not isinstance(context.compile_state, _ORMSelectCompileState):
2021 # issue 7505 - subqueryload() in 1.3 and previous would silently
2022 # degrade for from_statement() without warning. this behavior
2023 # is restored here
2024 return
2025
2026 if not self.parent.class_manager[self.key].impl.supports_population:
2027 raise sa_exc.InvalidRequestError(
2028 "'%s' does not support object "
2029 "population - eager loading cannot be applied." % self
2030 )
2031
2032 # a little dance here as the "path" is still something that only
2033 # semi-tracks the exact series of things we are loading, still not
2034 # telling us about with_polymorphic() and stuff like that when it's at
2035 # the root.. the initial MapperEntity is more accurate for this case.
2036 if len(path) == 1:

Callers

nothing calls this directly

Calls 8

_create_scalar_loaderMethod · 0.95
_setup_for_recursionMethod · 0.80
isaMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected