A namespace of all :class:`.MapperProperty` objects associated this mapper. This is an object that provides each property based on its key name. For instance, the mapper for a ``User`` class which has ``User.name`` attribute would provide ``mapper.attrs.name
(self)
| 2983 | |
| 2984 | @HasMemoized.memoized_attribute |
| 2985 | def attrs(self) -> util.ReadOnlyProperties[MapperProperty[Any]]: |
| 2986 | """A namespace of all :class:`.MapperProperty` objects |
| 2987 | associated this mapper. |
| 2988 | |
| 2989 | This is an object that provides each property based on |
| 2990 | its key name. For instance, the mapper for a |
| 2991 | ``User`` class which has ``User.name`` attribute would |
| 2992 | provide ``mapper.attrs.name``, which would be the |
| 2993 | :class:`.ColumnProperty` representing the ``name`` |
| 2994 | column. The namespace object can also be iterated, |
| 2995 | which would yield each :class:`.MapperProperty`. |
| 2996 | |
| 2997 | :class:`_orm.Mapper` has several pre-filtered views |
| 2998 | of this attribute which limit the types of properties |
| 2999 | returned, including :attr:`.synonyms`, :attr:`.column_attrs`, |
| 3000 | :attr:`.relationships`, and :attr:`.composites`. |
| 3001 | |
| 3002 | .. warning:: |
| 3003 | |
| 3004 | The :attr:`_orm.Mapper.attrs` accessor namespace is an |
| 3005 | instance of :class:`.OrderedProperties`. This is |
| 3006 | a dictionary-like object which includes a small number of |
| 3007 | named methods such as :meth:`.OrderedProperties.items` |
| 3008 | and :meth:`.OrderedProperties.values`. When |
| 3009 | accessing attributes dynamically, favor using the dict-access |
| 3010 | scheme, e.g. ``mapper.attrs[somename]`` over |
| 3011 | ``getattr(mapper.attrs, somename)`` to avoid name collisions. |
| 3012 | |
| 3013 | .. seealso:: |
| 3014 | |
| 3015 | :attr:`_orm.Mapper.all_orm_descriptors` |
| 3016 | |
| 3017 | """ |
| 3018 | |
| 3019 | self._check_configure() |
| 3020 | return util.ReadOnlyProperties(self._props) |
| 3021 | |
| 3022 | @HasMemoized.memoized_attribute |
| 3023 | def all_orm_descriptors(self) -> util.ReadOnlyProperties[InspectionAttr]: |
nothing calls this directly
no test coverage detected