Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /rubelw_OSSS /src /OSSS /db /models /embeds.py
| # The purpose of the `Embed` model is to represent external media or content | |
| # (like videos, audio tracks, design links, etc.) that can be attached to | |
| # or referenced from within your OSSS system. | |
| # | |
| # Key points: | |
| # - Inherits from UUIDMixin and Base: | |
| # -> provides a unique UUID primary key (`id`) plus standard ORM mapping. | |
| # | |
| # - `provider`: | |
| # -> The service that hosts the embed (e.g., YouTube, Vimeo, Spotify). | |
| # -> Stored as a short string (up to 64 characters). | |
| # | |
| # - `url`: | |
| # -> The actual URL to the embedded resource. | |
| # -> Allows up to 1024 characters to accommodate long provider URLs. | |
| # | |
| # - `meta`: | |
| # -> A JSONB column for flexible metadata. | |
| # -> Can store provider-specific details (title, thumbnail, dimensions, tags). | |
| # -> Optional field so rows can exist with or without metadata. | |
| # | |
| # In practice: | |
| # - This model provides a standardized way to reference external media inside | |
| # OSSS (like attaching a YouTube lecture, SoundCloud clip, Figma design, etc.). | |
| # - The JSONB `meta` allows unstructured, provider-specific info without schema changes. | |
| # - Useful for linking supplemental resources, multimedia content, or external | |
| # references directly to internal objects (courses, goals, notes, etc.). | |
| from __future__ import annotations | |
| from datetime import datetime, date, time | |
| from decimal import Decimal | |
| from typing import Any, Optional, List, ClassVar | |
| import sqlalchemy as sa | |
| from sqlalchemy import ForeignKey, UniqueConstraint, text | |
| from sqlalchemy.orm import Mapped, mapped_column, relationship | |
| from OSSS.db.base import Base, UUIDMixin, GUID, JSONB | |
| class Embed(UUIDMixin, Base): | |
| __tablename__ = "embeds" | |
| __allow_unmapped__ = True # keep NOTE out of the SQLAlchemy mapper | |
| NOTE: ClassVar[str] = ( | |
| "owner=division_of_technology_data; " | |
| "description=Stores embeds records for the application. " | |
| "Includes standard audit timestamps (created_at, updated_at). " | |
| "6 column(s) defined. " | |
| "Primary key is `id`." | |
| ) | |
| __table_args__ = { | |
| "comment": ( | |
| "Stores embeds records for the application. " | |
| "Includes standard audit timestamps (created_at, updated_at). " | |
| "6 column(s) defined. " | |
| "Primary key is `id`." | |
| ), | |
| "info": { | |
| "note": NOTE, | |
| "description": ( | |
| "Stores embeds records for the application. " | |
| "Includes standard audit timestamps (created_at, updated_at). " | |
| "6 column(s) defined. " | |
| "Primary key is `id`." | |
| ), | |
| }, | |
| } | |
| provider: Mapped[str] = mapped_column(sa.String(64), nullable=False) | |
| url: Mapped[str] = mapped_column(sa.String(1024), nullable=False) | |
| meta: Mapped[Optional[dict]] = mapped_column(JSONB()) | |
Xet Storage Details
- Size:
- 2.81 kB
- Xet hash:
- 8df3d1992c6056bf7ee28baa976f2341dde4247c9f6d221f26dc9cc5432d4771
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.