MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / configure

Method configure

lib/sqlalchemy/orm/decl_api.py:1477–1516  ·  lib/sqlalchemy/orm/decl_api.py::registry.configure

Configure all as-yet unconfigured mappers in this :class:`_orm.registry`. The configure step is used to reconcile and initialize the :func:`_orm.relationship` linkages between mapped classes, as well as to invoke configuration events such as the :meth:`_orm.M

(self, cascade: bool = False)

Source from the content-addressed store, hash-verified

1475 manager.registry = self
1476
1477 def configure(self, cascade: bool = False) -> None:
1478 class="st">"""Configure all as-yet unconfigured mappers in this
1479 :class:`_orm.registry`.
1480
1481 The configure step is used to reconcile and initialize the
1482 :func:`_orm.relationship` linkages between mapped classes, as well as
1483 to invoke configuration events such as the
1484 :meth:`_orm.MapperEvents.before_configured` and
1485 :meth:`_orm.MapperEvents.after_configured`, which may be used by ORM
1486 extensions or user-defined extension hooks.
1487
1488 If one or more mappers in this registry contain
1489 :func:`_orm.relationship` constructs that refer to mapped classes in
1490 other registries, this registry is said to be *dependent* on those
1491 registries. In order to configure those dependent registries
1492 automatically, the :paramref:`_orm.registry.configure.cascade` flag
1493 should be set to ``True``. Otherwise, if they are not configured, an
1494 exception will be raised. The rationale behind this behavior is to
1495 allow an application to programmatically invoke configuration of
1496 registries while controlling whether or not the process implicitly
1497 reaches other registries.
1498
1499 As an alternative to invoking :meth:`_orm.registry.configure`, the ORM
1500 function :func:`_orm.configure_mappers` function may be used to ensure
1501 configuration is complete for all :class:`_orm.registry` objects in
1502 memory. This is generally simpler to use and also predates the usage of
1503 :class:`_orm.registry` objects overall. However, this function will
1504 impact all mappings throughout the running Python process and may be
1505 more memory/time consuming for an application that has many registries
1506 in use for different purposes that may not be needed immediately.
1507
1508 .. seealso::
1509
1510 :func:`_orm.configure_mappers`
1511
1512
1513 .. versionadded:: 1.4.0b2
1514
1515 class="st">"""
1516 mapperlib._configure_registries({self}, cascade=cascade)
1517
1518 def dispose(self, cascade: bool = False) -> None:
1519 class="st">"""Dispose of all mappers in this :class:`_orm.registry`.

Calls

no outgoing calls