MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / bind_table

Method bind_table

lib/sqlalchemy/orm/session.py:2765–2791  ·  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

2763 self._add_bind(mapper, bind)
2764
2765 def bind_table(self, table: TableClause, bind: _SessionBind) -> None:
2766 """Associate a :class:`_schema.Table` with a "bind", e.g. an
2767 :class:`_engine.Engine`
2768 or :class:`_engine.Connection`.
2769
2770 The given :class:`_schema.Table` is added to a lookup used by the
2771 :meth:`.Session.get_bind` method.
2772
2773 :param table: a :class:`_schema.Table` object,
2774 which is typically the target
2775 of an ORM mapping, or is present within a selectable that is
2776 mapped.
2777
2778 :param bind: an :class:`_engine.Engine` or :class:`_engine.Connection`
2779 object.
2780
2781 .. seealso::
2782
2783 :ref:`session_partitioning`
2784
2785 :paramref:`.Session.binds`
2786
2787 :meth:`.Session.bind_mapper`
2788
2789
2790 """
2791 self._add_bind(table, bind)
2792
2793 def get_bind(
2794 self,

Callers 1

test_get_bindMethod · 0.95

Calls 1

_add_bindMethod · 0.95

Tested by 1

test_get_bindMethod · 0.76