MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/orm/mapper.py:195–849  ·  view source on GitHub ↗

r"""Direct constructor for a new :class:`_orm.Mapper` object. The :class:`_orm.Mapper` constructor is not called directly, and is normally invoked through the use of the :class:`_orm.registry` object through either the :ref:`Declarative <orm_declarative_mapping>` or

(
        self,
        class_: Type[_O],
        local_table: Optional[FromClause] = None,
        properties: Optional[Mapping[str, MapperProperty[Any]]] = None,
        primary_key: Optional[Iterable[_ORMColumnExprArgument[Any]]] = None,
        inherits: Optional[Union[Mapper[Any], Type[Any]]] = None,
        inherit_condition: Optional[_ColumnExpressionArgument[bool]] = None,
        inherit_foreign_keys: Optional[
            Sequence[_ORMColumnExprArgument[Any]]
        ] = None,
        always_refresh: bool = False,
        version_id_col: Optional[_ORMColumnExprArgument[Any]] = None,
        version_id_generator: Optional[
            Union[Literal[False], Callable[[Any], Any]]
        ] = None,
        polymorphic_on: Optional[
            Union[_ORMColumnExprArgument[Any], str, MapperProperty[Any]]
        ] = None,
        _polymorphic_map: Optional[Dict[Any, Mapper[Any]]] = None,
        polymorphic_identity: Optional[Any] = None,
        concrete: bool = False,
        with_polymorphic: Optional[_WithPolymorphicArg] = None,
        polymorphic_abstract: bool = False,
        polymorphic_load: Optional[Literal["selectin", "inline"]] = None,
        allow_partial_pks: bool = True,
        batch: bool = True,
        column_prefix: Optional[str] = None,
        include_properties: Optional[Sequence[str]] = None,
        exclude_properties: Optional[Sequence[str]] = None,
        passive_updates: bool = True,
        passive_deletes: bool = False,
        confirm_deleted_rows: bool = True,
        eager_defaults: Literal[True, False, "auto"] = "auto",
        legacy_is_orphan: bool = False,
        _compiled_cache_size: int = 100,
    )

Source from the content-addressed store, hash-verified

193 _ready_for_configure = False
194
195 def __init__(
196 self,
197 class_: Type[_O],
198 local_table: Optional[FromClause] = None,
199 properties: Optional[Mapping[str, MapperProperty[Any]]] = None,
200 primary_key: Optional[Iterable[_ORMColumnExprArgument[Any]]] = None,
201 inherits: Optional[Union[Mapper[Any], Type[Any]]] = None,
202 inherit_condition: Optional[_ColumnExpressionArgument[bool]] = None,
203 inherit_foreign_keys: Optional[
204 Sequence[_ORMColumnExprArgument[Any]]
205 ] = None,
206 always_refresh: bool = False,
207 version_id_col: Optional[_ORMColumnExprArgument[Any]] = None,
208 version_id_generator: Optional[
209 Union[Literal[False], Callable[[Any], Any]]
210 ] = None,
211 polymorphic_on: Optional[
212 Union[_ORMColumnExprArgument[Any], str, MapperProperty[Any]]
213 ] = None,
214 _polymorphic_map: Optional[Dict[Any, Mapper[Any]]] = None,
215 polymorphic_identity: Optional[Any] = None,
216 concrete: bool = False,
217 with_polymorphic: Optional[_WithPolymorphicArg] = None,
218 polymorphic_abstract: bool = False,
219 polymorphic_load: Optional[Literal["selectin", "inline"]] = None,
220 allow_partial_pks: bool = True,
221 batch: bool = True,
222 column_prefix: Optional[str] = None,
223 include_properties: Optional[Sequence[str]] = None,
224 exclude_properties: Optional[Sequence[str]] = None,
225 passive_updates: bool = True,
226 passive_deletes: bool = False,
227 confirm_deleted_rows: bool = True,
228 eager_defaults: Literal[True, False, "auto"] = "auto",
229 legacy_is_orphan: bool = False,
230 _compiled_cache_size: int = 100,
231 ):
232 r"""Direct constructor for a new :class:`_orm.Mapper` object.
233
234 The :class:`_orm.Mapper` constructor is not called directly, and
235 is normally invoked through the
236 use of the :class:`_orm.registry` object through either the
237 :ref:`Declarative <orm_declarative_mapping>` or
238 :ref:`Imperative <orm_imperative_mapping>` mapping styles.
239
240 .. versionchanged:: 2.0 The public facing ``mapper()`` function is
241 removed; for a classical mapping configuration, use the
242 :meth:`_orm.registry.map_imperatively` method.
243
244 Parameters documented below may be passed to either the
245 :meth:`_orm.registry.map_imperatively` method, or may be passed in the
246 ``__mapper_args__`` declarative class attribute described at
247 :ref:`orm_declarative_mapper_options`.
248
249 :param class\_: The class to be mapped. When using Declarative,
250 this argument is automatically passed as the declared class
251 itself.
252

Callers

nothing calls this directly

Calls 14

_set_with_polymorphicMethod · 0.95
_configure_propertiesMethod · 0.95
_configure_pksMethod · 0.95
_logMethod · 0.95
_expire_memoizationsMethod · 0.95
_parse_mapper_argumentFunction · 0.85
to_setMethod · 0.80
_new_mapper_instanceMethod · 0.80
_flag_new_mapperMethod · 0.80

Tested by

no test coverage detected