(self, key: _SessionBindKey, bind: _SessionBind)
| 2614 | statelib.InstanceState._detach_states(all_states, self) |
| 2615 | |
| 2616 | def _add_bind(self, key: _SessionBindKey, bind: _SessionBind) -> None: |
| 2617 | try: |
| 2618 | insp = inspect(key) |
| 2619 | except sa_exc.NoInspectionAvailable as err: |
| 2620 | if not isinstance(key, type): |
| 2621 | raise sa_exc.ArgumentError( |
| 2622 | "Not an acceptable bind target: %s" % key |
| 2623 | ) from err |
| 2624 | else: |
| 2625 | self.__binds[key] = bind |
| 2626 | else: |
| 2627 | if TYPE_CHECKING: |
| 2628 | assert isinstance(insp, Inspectable) |
| 2629 | |
| 2630 | if isinstance(insp, TableClause): |
| 2631 | self.__binds[insp] = bind |
| 2632 | elif insp_is_mapper(insp): |
| 2633 | self.__binds[insp.class_] = bind |
| 2634 | for _selectable in insp._all_tables: |
| 2635 | self.__binds[_selectable] = bind |
| 2636 | else: |
| 2637 | raise sa_exc.ArgumentError( |
| 2638 | "Not an acceptable bind target: %s" % key |
| 2639 | ) |
| 2640 | |
| 2641 | def bind_mapper( |
| 2642 | self, mapper: _EntityBindKey[_O], bind: _SessionBind |
no test coverage detected