After upgrade HA is broken
the recursive problem is
raise sa_exc.ArgumentError(
gen 29 19:18:35 sdomotica Home Assistant[4187]: sqlalchemy.exc.ArgumentError: Type annotation for “Statistics.metadata_id” can’t be correctly interpreted for Annotated Declarative Table form. ORM annotations should normally make use of the Mapped[]
generic type, or other ORM-compatible generic type, as a container for the actual type, which indicates the intent that the attribute is mapped. Class variables that are not intended to be mapped by the ORM should use ClassVar[]. To allow Annotated Declarative to disregard legacy annotations which don’t use Mapped[] to pass, set “allow_unmapped = True” on the class or a superclass this class. (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)