Return the attribute name that should be used to refer from one class to another, for a scalar object reference. The default implementation is:: return referred_cls.__name__.lower() Alternate implementations can be specified using the :paramref:`.AutomapBase.prepare.name_f
(
base: Type[Any],
local_cls: Type[Any],
referred_cls: Type[Any],
constraint: ForeignKeyConstraint,
)
| 812 | |
| 813 | |
| 814 | def name_for_scalar_relationship( |
| 815 | base: Type[Any], |
| 816 | local_cls: Type[Any], |
| 817 | referred_cls: Type[Any], |
| 818 | constraint: ForeignKeyConstraint, |
| 819 | ) -> str: |
| 820 | """Return the attribute name that should be used to refer from one |
| 821 | class to another, for a scalar object reference. |
| 822 | |
| 823 | The default implementation is:: |
| 824 | |
| 825 | return referred_cls.__name__.lower() |
| 826 | |
| 827 | Alternate implementations can be specified using the |
| 828 | :paramref:`.AutomapBase.prepare.name_for_scalar_relationship` |
| 829 | parameter. |
| 830 | |
| 831 | :param base: the :class:`.AutomapBase` class doing the prepare. |
| 832 | |
| 833 | :param local_cls: the class to be mapped on the local side. |
| 834 | |
| 835 | :param referred_cls: the class to be mapped on the referring side. |
| 836 | |
| 837 | :param constraint: the :class:`_schema.ForeignKeyConstraint` that is being |
| 838 | inspected to produce this relationship. |
| 839 | |
| 840 | """ |
| 841 | return referred_cls.__name__.lower() |
| 842 | |
| 843 | |
| 844 | class NameForCollectionRelationshipType(Protocol): |
no test coverage detected