Return the attribute name that should be used to refer from one class to another, for a collection reference. The default implementation is:: return referred_cls.__name__.lower() + "_collection" Alternate implementations can be specified using the :paramref:`.AutomapBa
(
base: Type[Any],
local_cls: Type[Any],
referred_cls: Type[Any],
constraint: ForeignKeyConstraint,
)
| 852 | |
| 853 | |
| 854 | def name_for_collection_relationship( |
| 855 | base: Type[Any], |
| 856 | local_cls: Type[Any], |
| 857 | referred_cls: Type[Any], |
| 858 | constraint: ForeignKeyConstraint, |
| 859 | ) -> str: |
| 860 | """Return the attribute name that should be used to refer from one |
| 861 | class to another, for a collection reference. |
| 862 | |
| 863 | The default implementation is:: |
| 864 | |
| 865 | return referred_cls.__name__.lower() + "_collection" |
| 866 | |
| 867 | Alternate implementations |
| 868 | can be specified using the |
| 869 | :paramref:`.AutomapBase.prepare.name_for_collection_relationship` |
| 870 | parameter. |
| 871 | |
| 872 | :param base: the :class:`.AutomapBase` class doing the prepare. |
| 873 | |
| 874 | :param local_cls: the class to be mapped on the local side. |
| 875 | |
| 876 | :param referred_cls: the class to be mapped on the referring side. |
| 877 | |
| 878 | :param constraint: the :class:`_schema.ForeignKeyConstraint` that is being |
| 879 | inspected to produce this relationship. |
| 880 | |
| 881 | """ |
| 882 | return referred_cls.__name__.lower() + "_collection" |
| 883 | |
| 884 | |
| 885 | class GenerateRelationshipType(Protocol): |
no test coverage detected