Associate a :class:`_orm.Mapper` or arbitrary Python class with a "bind", e.g. an :class:`_engine.Engine` or :class:`_engine.Connection`. The given entity is added to a lookup used by the :meth:`.Session.get_bind` method. :param mapper: a :class:`_orm.Mapper
(
self, mapper: _EntityBindKey[_O], bind: _SessionBind
)
| 2639 | ) |
| 2640 | |
| 2641 | def bind_mapper( |
| 2642 | self, mapper: _EntityBindKey[_O], bind: _SessionBind |
| 2643 | ) -> None: |
| 2644 | """Associate a :class:`_orm.Mapper` or arbitrary Python class with a |
| 2645 | "bind", e.g. an :class:`_engine.Engine` or |
| 2646 | :class:`_engine.Connection`. |
| 2647 | |
| 2648 | The given entity is added to a lookup used by the |
| 2649 | :meth:`.Session.get_bind` method. |
| 2650 | |
| 2651 | :param mapper: a :class:`_orm.Mapper` object, |
| 2652 | or an instance of a mapped |
| 2653 | class, or any Python class that is the base of a set of mapped |
| 2654 | classes. |
| 2655 | |
| 2656 | :param bind: an :class:`_engine.Engine` or :class:`_engine.Connection` |
| 2657 | object. |
| 2658 | |
| 2659 | .. seealso:: |
| 2660 | |
| 2661 | :ref:`session_partitioning` |
| 2662 | |
| 2663 | :paramref:`.Session.binds` |
| 2664 | |
| 2665 | :meth:`.Session.bind_table` |
| 2666 | |
| 2667 | |
| 2668 | """ |
| 2669 | self._add_bind(mapper, bind) |
| 2670 | |
| 2671 | def bind_table(self, table: TableClause, bind: _SessionBind) -> None: |
| 2672 | """Associate a :class:`_schema.Table` with a "bind", e.g. an |