Return the class name that should be used, given the name of a table. The default implementation is:: return str(tablename) Alternate implementations can be specified using the :paramref:`.AutomapBase.prepare.classname_for_table` parameter. :param base: the :class
(
base: Type[Any],
tablename: str,
table: Table,
)
| 765 | |
| 766 | |
| 767 | def classname_for_table( |
| 768 | base: Type[Any], |
| 769 | tablename: str, |
| 770 | table: Table, |
| 771 | ) -> str: |
| 772 | """Return the class name that should be used, given the name |
| 773 | of a table. |
| 774 | |
| 775 | The default implementation is:: |
| 776 | |
| 777 | return str(tablename) |
| 778 | |
| 779 | Alternate implementations can be specified using the |
| 780 | :paramref:`.AutomapBase.prepare.classname_for_table` |
| 781 | parameter. |
| 782 | |
| 783 | :param base: the :class:`.AutomapBase` class doing the prepare. |
| 784 | |
| 785 | :param tablename: string name of the :class:`_schema.Table`. |
| 786 | |
| 787 | :param table: the :class:`_schema.Table` object itself. |
| 788 | |
| 789 | :return: a string class name. |
| 790 | |
| 791 | .. note:: |
| 792 | |
| 793 | In Python 2, the string used for the class name **must** be a |
| 794 | non-Unicode object, e.g. a ``str()`` object. The ``.name`` attribute |
| 795 | of :class:`_schema.Table` is typically a Python unicode subclass, |
| 796 | so the |
| 797 | ``str()`` function should be applied to this name, after accounting for |
| 798 | any non-ASCII characters. |
| 799 | |
| 800 | """ |
| 801 | return str(tablename) |
| 802 | |
| 803 | |
| 804 | class NameForScalarRelationshipType(Protocol): |