25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

15 lines
289 B

  1. from typing import Any
  2. from sqlalchemy.ext.declarative import as_declarative, declared_attr
  3. @as_declarative()
  4. class Base:
  5. id: Any
  6. __name__: str
  7. # Generate __tablename__ automatically
  8. @declared_attr
  9. def __tablename__(cls) -> str:
  10. return cls.__name__.lower()