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

Method bind_table

lib/sqlalchemy/orm/session.py:2671–2697  ·  view source on GitHub ↗

Associate a :class:`_schema.Table` with a "bind", e.g. an :class:`_engine.Engine` or :class:`_engine.Connection`. The given :class:`_schema.Table` is added to a lookup used by the :meth:`.Session.get_bind` method. :param table: a :class:`_schema.Table` objec

(self, table: TableClause, bind: _SessionBind)

Source from the content-addressed store, hash-verified

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
2673 :class:`_engine.Engine`
2674 or :class:`_engine.Connection`.
2675
2676 The given :class:`_schema.Table` is added to a lookup used by the
2677 :meth:`.Session.get_bind` method.
2678
2679 :param table: a :class:`_schema.Table` object,
2680 which is typically the target
2681 of an ORM mapping, or is present within a selectable that is
2682 mapped.
2683
2684 :param bind: an :class:`_engine.Engine` or :class:`_engine.Connection`
2685 object.
2686
2687 .. seealso::
2688
2689 :ref:`session_partitioning`
2690
2691 :paramref:`.Session.binds`
2692
2693 :meth:`.Session.bind_mapper`
2694
2695
2696 """
2697 self._add_bind(table, bind)
2698
2699 def get_bind(
2700 self,

Callers 1

test_get_bindMethod · 0.95

Calls 1

_add_bindMethod · 0.95

Tested by 1

test_get_bindMethod · 0.76