(self)
| 1718 | } |
| 1719 | |
| 1720 | def _configure_properties(self) -> None: |
| 1721 | self.columns = self.c = sql_base.ColumnCollection() # type: ignore |
| 1722 | |
| 1723 | # object attribute names mapped to MapperProperty objects |
| 1724 | self._props = util.OrderedDict() |
| 1725 | |
| 1726 | # table columns mapped to MapperProperty |
| 1727 | self._columntoproperty = _ColumnMapping(self) |
| 1728 | |
| 1729 | explicit_col_props_by_column: Dict[ |
| 1730 | KeyedColumnElement[Any], Tuple[str, ColumnProperty[Any]] |
| 1731 | ] = {} |
| 1732 | explicit_col_props_by_key: Dict[str, ColumnProperty[Any]] = {} |
| 1733 | |
| 1734 | # step 1: go through properties that were explicitly passed |
| 1735 | # in the properties dictionary. For Columns that are local, put them |
| 1736 | # aside in a separate collection we will reconcile with the Table |
| 1737 | # that's given. For other properties, set them up in _props now. |
| 1738 | if self._init_properties: |
| 1739 | for key, prop_arg in self._init_properties.items(): |
| 1740 | if not isinstance(prop_arg, MapperProperty): |
| 1741 | possible_col_prop = self._make_prop_from_column( |
| 1742 | key, prop_arg |
| 1743 | ) |
| 1744 | else: |
| 1745 | possible_col_prop = prop_arg |
| 1746 | |
| 1747 | # issue #8705. if the explicit property is actually a |
| 1748 | # Column that is local to the local Table, don't set it up |
| 1749 | # in ._props yet, integrate it into the order given within |
| 1750 | # the Table. |
| 1751 | |
| 1752 | _map_as_property_now = True |
| 1753 | if isinstance(possible_col_prop, properties.ColumnProperty): |
| 1754 | for given_col in possible_col_prop.columns: |
| 1755 | if self.local_table.c.contains_column(given_col): |
| 1756 | _map_as_property_now = False |
| 1757 | explicit_col_props_by_key[key] = possible_col_prop |
| 1758 | explicit_col_props_by_column[given_col] = ( |
| 1759 | key, |
| 1760 | possible_col_prop, |
| 1761 | ) |
| 1762 | |
| 1763 | if _map_as_property_now: |
| 1764 | self._configure_property( |
| 1765 | key, |
| 1766 | possible_col_prop, |
| 1767 | init=False, |
| 1768 | ) |
| 1769 | |
| 1770 | # step 2: pull properties from the inherited mapper. reconcile |
| 1771 | # columns with those which are explicit above. for properties that |
| 1772 | # are only in the inheriting mapper, set them up as local props |
| 1773 | if self.inherits: |
| 1774 | for key, inherited_prop in self.inherits._props.items(): |
| 1775 | if self._should_exclude(key, key, local=False, column=None): |
| 1776 | continue |
| 1777 |
no test coverage detected