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

Method __init__

lib/sqlalchemy/orm/mapper.py:202–872  ·  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 ` or

(
        self,
        class_: Type[_O],
        local_table: Optional[FromClause] = None,
        properties: Optional[Mapping[str, MapperProperty[Any]]] = None,
        primary_key: Optional[Iterable[_ORMColumnExprArgument[Any]]] = None,
        non_primary: bool = False,
        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

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

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
castFunction · 0.85
to_setMethod · 0.80
_new_mapper_instanceMethod · 0.80

Tested by

no test coverage detected