MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _mapper_fn

Function _mapper_fn

lib/sqlalchemy/orm/_orm_constructors.py:2154–2178  ·  view source on GitHub ↗

Placeholder for the now-removed ``mapper()`` function. Classical mappings should be performed using the :meth:`_orm.registry.map_imperatively` method. This symbol remains in SQLAlchemy 2.0 to suit the deprecated use case of using the ``mapper()`` function as a target for ORM event

(*arg: Any, **kw: Any)

Source from the content-addressed store, hash-verified

2152
2153
2154def _mapper_fn(*arg: Any, **kw: Any) -> NoReturn:
2155 """Placeholder for the now-removed ``mapper()`` function.
2156
2157 Classical mappings should be performed using the
2158 :meth:`_orm.registry.map_imperatively` method.
2159
2160 This symbol remains in SQLAlchemy 2.0 to suit the deprecated use case
2161 of using the ``mapper()`` function as a target for ORM event listeners,
2162 which failed to be marked as deprecated in the 1.4 series.
2163
2164 Global ORM mapper listeners should instead use the :class:`_orm.Mapper`
2165 class as the target.
2166
2167 .. versionchanged:: 2.0 The ``mapper()`` function was removed; the
2168 symbol remains temporarily as a placeholder for the event listening
2169 use case.
2170
2171 """
2172 raise InvalidRequestError(
2173 "The 'sqlalchemy.orm.mapper()' function is removed as of "
2174 "SQLAlchemy 2.0. Use the "
2175 "'sqlalchemy.orm.registry.map_imperatively()` "
2176 "method of the ``sqlalchemy.orm.registry`` class to perform "
2177 "classical mapping."
2178 )
2179
2180
2181def dynamic_loader(

Callers

nothing calls this directly

Calls 1

InvalidRequestErrorClass · 0.85

Tested by

no test coverage detected