r"""Indicate a column-based mapped attribute that by default will not load unless accessed. When using :func:`_orm.mapped_column`, the same functionality as that of :func:`_orm.deferred` construct is provided by using the :paramref:`_orm.mapped_column.deferred` parameter. :para
(
column: _ORMColumnExprArgument[_T],
*additional_columns: _ORMColumnExprArgument[Any],
group: Optional[str] = None,
raiseload: bool = False,
comparator_factory: Optional[Type[PropComparator[_T]]] = None,
init: Union[_NoArg, bool] = _NoArg.NO_ARG,
repr: Union[_NoArg, bool] = _NoArg.NO_ARG, # noqa: A002
default: Optional[Any] = _NoArg.NO_ARG,
default_factory: Union[_NoArg, Callable[[], _T]] = _NoArg.NO_ARG,
compare: Union[_NoArg, bool] = _NoArg.NO_ARG,
kw_only: Union[_NoArg, bool] = _NoArg.NO_ARG,
hash: Union[_NoArg, bool, None] = _NoArg.NO_ARG, # noqa: A002
active_history: bool = False,
expire_on_flush: bool = True,
info: Optional[_InfoType] = None,
doc: Optional[str] = None,
dataclass_metadata: Union[_NoArg, Mapping[Any, Any], None] = _NoArg.NO_ARG,
)
| 2225 | |
| 2226 | |
| 2227 | def deferred( |
| 2228 | column: _ORMColumnExprArgument[_T], |
| 2229 | *additional_columns: _ORMColumnExprArgument[Any], |
| 2230 | group: Optional[str] = None, |
| 2231 | raiseload: bool = False, |
| 2232 | comparator_factory: Optional[Type[PropComparator[_T]]] = None, |
| 2233 | init: Union[_NoArg, bool] = _NoArg.NO_ARG, |
| 2234 | repr: Union[_NoArg, bool] = _NoArg.NO_ARG, class="cm"># noqa: A002 |
| 2235 | default: Optional[Any] = _NoArg.NO_ARG, |
| 2236 | default_factory: Union[_NoArg, Callable[[], _T]] = _NoArg.NO_ARG, |
| 2237 | compare: Union[_NoArg, bool] = _NoArg.NO_ARG, |
| 2238 | kw_only: Union[_NoArg, bool] = _NoArg.NO_ARG, |
| 2239 | hash: Union[_NoArg, bool, None] = _NoArg.NO_ARG, class="cm"># noqa: A002 |
| 2240 | active_history: bool = False, |
| 2241 | expire_on_flush: bool = True, |
| 2242 | info: Optional[_InfoType] = None, |
| 2243 | doc: Optional[str] = None, |
| 2244 | dataclass_metadata: Union[_NoArg, Mapping[Any, Any], None] = _NoArg.NO_ARG, |
| 2245 | ) -> MappedSQLExpression[_T]: |
| 2246 | rclass="st">"""Indicate a column-based mapped attribute that by default will |
| 2247 | not load unless accessed. |
| 2248 | |
| 2249 | When using :func:`_orm.mapped_column`, the same functionality as |
| 2250 | that of :func:`_orm.deferred` construct is provided by using the |
| 2251 | :paramref:`_orm.mapped_column.deferred` parameter. |
| 2252 | |
| 2253 | :param \*columns: columns to be mapped. This is typically a single |
| 2254 | :class:`_schema.Column` object, |
| 2255 | however a collection is supported in order |
| 2256 | to support multiple columns mapped under the same attribute. |
| 2257 | |
| 2258 | :param raiseload: boolean, if True, indicates an exception should be raised |
| 2259 | if the load operation is to take place. |
| 2260 | |
| 2261 | .. versionadded:: 1.4 |
| 2262 | |
| 2263 | |
| 2264 | Additional arguments are the same as that of :func:`_orm.column_property`. |
| 2265 | |
| 2266 | .. seealso:: |
| 2267 | |
| 2268 | :ref:`orm_queryguide_deferred_imperative` |
| 2269 | |
| 2270 | class="st">""" |
| 2271 | return MappedSQLExpression( |
| 2272 | column, |
| 2273 | *additional_columns, |
| 2274 | attribute_options=_AttributeOptions( |
| 2275 | init, |
| 2276 | repr, |
| 2277 | default, |
| 2278 | default_factory, |
| 2279 | compare, |
| 2280 | kw_only, |
| 2281 | hash, |
| 2282 | dataclass_metadata, |
| 2283 | ), |
| 2284 | group=group, |