class_docstr: DeclarativeBase mixin that sets a model's ``__tablename__`` by converting the
  ``CamelCase`` class name to ``snake_case``. A name is set for non-abstract models
  that do not otherwise define ``__tablename__``. If a model does not define a primary
  key, it will not generate a name or ``__table__``, for single-table inheritance.
  
  .. versionchanged:: 3.1.0
class_docstr_tok: ["DeclarativeBase","mixin","that","sets","a","model","'s","``","__tablename__","``","by","converting","the","``","CamelCase","``","class","name","to","``","snake_case","``",".","A","name","is","set","for","non-abstract","models","that","do","not","otherwise","define","``","__tablename__","``",".","If","a","model","does","not","define","a","primary","key",",","it","will","not","generate","a","name","or","``","__table__","``",",","for","single-table","inheritance",".","..","versionchanged",":",":","3.1.0"]
docstr: This is called by SQLAlchemy during mapper setup. It determines the final
  table object that the model will use.
  
  If no primary key is found, that indicates single-table inheritance, so no table
  will be created and ``__tablename__`` will be unset.
docstr_tok: ["This","is","called","by","SQLAlchemy","during","mapper","setup",".","It","determines","the","final","table","object","that","the","model","will","use",".","If","no","primary","key","is","found",",","that","indicates","single-table","inheritance",",","so","no","table","will","be","created","and","``","__tablename__","``","will","be","unset","."]
code: def __table_cls__(
      cls, *args: t.Any, **kwargs: t.Any
  ) -> sa.Table | None:
      """This is called by SQLAlchemy during mapper setup. It determines the final
      table object that the model will use.
  
      If no primary key is found, that indicates single-table inheritance, so no table
      will be created and ``__tablename__`` will be unset.
      """
      schema = kwargs.get("schema")
  
      if schema is None:
          key = args[0]
      else:
          key = f"{schema}.{args[0]}"
  
      # Check if a table with this name already exists. Allows reflected tables to be
      # applied to models by name.
      if key in cls.metadata.tables:
          return sa.Table(*args, **kwargs)
  
      # If a primary key is found, create a table for joined-table inheritance.
      for arg in args:
          if (
              isinstance(arg, sa.Column) and arg.primary_key
          ) or isinstance(arg, sa.PrimaryKeyConstraint):
              return sa.Table(*args, **kwargs)
  
      # If no base classes define a table, return one that's missing a primary key
      # so SQLAlchemy shows the correct error.
      for base in cls.__mro__[1:-1]:
          if "__table__" in base.__dict__:
              break
      else:
          return sa.Table(*args, **kwargs)
  
      # Single-table inheritance, use the parent table name. __init__ will unset
      # __table__ based on this.
      if "__tablename__" in cls.__dict__:
          del cls.__tablename__
  
      return None
  
imports: from __future__ import annotations
  import re
  import typing
  import sqlalchemy
  import sqlalchemy.orm
  from .query import Query
label_desc: Use image node_id 2 for calling the NameMixin obj's underlying member method code with example usage: obj.__table_cls__(cls) and returns: None, sa, sa, sa