Spaces:
Running on T4
Running on T4
Download backend/app/modules/uploads/models.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/uploads/models.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/uploads/models.py
-
curl -L -o models.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/uploads/models.py
1.2 kB
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import BigInteger, CheckConstraint, DateTime, ForeignKey, Index, String, Text, text | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.common.base_model import Base, CreatedAtMixin, IdMixin | |
| class Upload(IdMixin, CreatedAtMixin, Base): | |
| """An object in the bucket. attached_at is set when a session references it; unattached rows are cleaned up.""" | |
| __tablename__ = "uploads" | |
| __table_args__ = ( | |
| CheckConstraint("kind IN ('video', 'thumbnail', 'audio', 'drill_video', 'image')", name="kind"), | |
| Index("ix_uploads_unattached_created_at", "created_at", postgresql_where=text("attached_at IS NULL")), | |
| ) | |
| owner_id: Mapped[uuid.UUID] = mapped_column( | |
| UUID(as_uuid=True), ForeignKey("accounts.id", ondelete="CASCADE"), index=True | |
| ) | |
| kind: Mapped[str] = mapped_column(String(12)) | |
| object_key: Mapped[str] = mapped_column(Text, unique=True) | |
| content_type: Mapped[str] = mapped_column(String(40)) | |
| size_bytes: Mapped[int] = mapped_column(BigInteger) | |
| attached_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True)) | |