Files
plantillas-proyectos/backend/api/v1/modules/public/reference_data/containers/models.py

22 lines
694 B
Python

from core.database import Base
from sqlalchemy import PrimaryKeyConstraint, String
from sqlalchemy.orm import Mapped, mapped_column
class Container(Base):
__tablename__ = "containers" # GContenedores
__table_args__ = (
PrimaryKeyConstraint("key", name="containers_pkey"),
{"extend_existing": True}, # opcional
)
key: Mapped[str] = mapped_column(
String(3), primary_key=True, nullable=False
) # mantiene ceros iniciales
description: Mapped[str] = mapped_column(
String(500), nullable=False
) # descripción legal en español
def __repr__(self):
return f"<Container(key={self.key}, description={self.description})>"