(
self, attr: _WriteOnlyAttributeImpl, state: InstanceState[_T]
)
| 510 | _from_obj: Tuple[FromClause, ...] |
| 511 | |
| 512 | def __init__( |
| 513 | self, attr: _WriteOnlyAttributeImpl, state: InstanceState[_T] |
| 514 | ): |
| 515 | instance = state.obj() |
| 516 | if TYPE_CHECKING: |
| 517 | assert instance |
| 518 | self.instance = instance |
| 519 | self.attr = attr |
| 520 | |
| 521 | mapper = object_mapper(instance) |
| 522 | prop = mapper._props[self.attr.key] |
| 523 | |
| 524 | if prop.secondary is not None: |
| 525 | # this is a hack right now. The Query only knows how to |
| 526 | # make subsequent joins() without a given left-hand side |
| 527 | # from self._from_obj[0]. We need to ensure prop.secondary |
| 528 | # is in the FROM. So we purposely put the mapper selectable |
| 529 | # in _from_obj[0] to ensure a user-defined join() later on |
| 530 | # doesn't fail, and secondary is then in _from_obj[1]. |
| 531 | |
| 532 | # note also, we are using the official ORM-annotated selectable |
| 533 | # from __clause_element__(), see #7868 |
| 534 | |
| 535 | # _no_filter_by annotation is to prevent this table from being |
| 536 | # considered by filter_by() as part of #8601 |
| 537 | self._from_obj = ( |
| 538 | prop.mapper.__clause_element__(), |
| 539 | prop.secondary._annotate({"_no_filter_by": True}), |
| 540 | ) |
| 541 | else: |
| 542 | self._from_obj = () |
| 543 | |
| 544 | self._where_criteria = ( |
| 545 | prop._with_parent(instance, alias_secondary=False), |
| 546 | ) |
| 547 | |
| 548 | if self.attr.order_by: |
| 549 | self._order_by_clauses = self.attr.order_by |
| 550 | else: |
| 551 | self._order_by_clauses = () |
| 552 | |
| 553 | def _add_all_impl(self, iterator: Iterable[_T]) -> None: |
| 554 | for item in iterator: |
nothing calls this directly
no test coverage detected