fooder-api/fooder/domain/base.py
Piotr Domański e2af49046c
All checks were successful
Python lint and test / linttest (push) Successful in 5m30s
[isort] ran with black profile
2024-08-04 16:17:16 +02:00

22 lines
532 B
Python

from sqlalchemy.orm import DeclarativeBase, Mapped, declared_attr, mapped_column
class Base(DeclarativeBase):
"""Base from DeclarativeBase"""
pass
class CommonMixin:
"""define a series of common elements that may be applied to mapped
classes using this class as a mixin class."""
@declared_attr.directive
def __tablename__(cls) -> str:
"""__tablename__.
:rtype: str
"""
return cls.__name__.lower() # type: ignore
id: Mapped[int] = mapped_column(primary_key=True)