(self, key: _SessionBindKey, bind: _SessionBind)
| 2708 | statelib.InstanceState._detach_states(all_states, self) |
| 2709 | |
| 2710 | def _add_bind(self, key: _SessionBindKey, bind: _SessionBind) -> None: |
| 2711 | try: |
| 2712 | insp = inspect(key) |
| 2713 | except sa_exc.NoInspectionAvailable as err: |
| 2714 | if not isinstance(key, type): |
| 2715 | raise sa_exc.ArgumentError( |
| 2716 | "Not an acceptable bind target: %s" % key |
| 2717 | ) from err |
| 2718 | else: |
| 2719 | self.__binds[key] = bind |
| 2720 | else: |
| 2721 | if TYPE_CHECKING: |
| 2722 | assert isinstance(insp, Inspectable) |
| 2723 | |
| 2724 | if isinstance(insp, TableClause): |
| 2725 | self.__binds[insp] = bind |
| 2726 | elif insp_is_mapper(insp): |
| 2727 | self.__binds[insp.class_] = bind |
| 2728 | for _selectable in insp._all_tables: |
| 2729 | self.__binds[_selectable] = bind |
| 2730 | else: |
| 2731 | raise sa_exc.ArgumentError( |
| 2732 | "Not an acceptable bind target: %s" % key |
| 2733 | ) |
| 2734 | |
| 2735 | def bind_mapper( |
| 2736 | self, mapper: _EntityBindKey[_O], bind: _SessionBind |
no test coverage detected