Buckets:

download
raw
2.71 kB
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 sqlalchemy.ext.associationproxy import association_proxy
from OSSS.db.base import Base, UUIDMixin, GUID, JSONB
class Department(UUIDMixin, Base):
__tablename__ = "departments"
__allow_unmapped__ = True # keep NOTE out of the SQLAlchemy mapper
NOTE: ClassVar[str] = (
"owner=division_of_technology_data; "
"description=Stores departments records for the application. "
"Key attributes include name. "
"References related entities via: school. "
"Includes standard audit timestamps (created_at, updated_at). "
"5 column(s) defined. "
"Primary key is `id`. "
"1 foreign key field(s) detected."
)
__table_args__ = {
"comment": (
"Stores departments records for the application. "
"Key attributes include name. "
"References related entities via: school. "
"Includes standard audit timestamps (created_at, updated_at). "
"5 column(s) defined. "
"Primary key is `id`. "
"1 foreign key field(s) detected."
),
"info": {
"note": NOTE,
"description": (
"Stores departments records for the application. "
"Key attributes include name. "
"References related entities via: school. "
"Includes standard audit timestamps (created_at, updated_at). "
"5 column(s) defined. "
"Primary key is `id`. "
"1 foreign key field(s) detected."
),
},
}
school_id: Mapped[Any] = mapped_column(GUID(), ForeignKey("schools.id", ondelete="CASCADE"), nullable=False)
name: Mapped[str] = mapped_column(sa.Text, nullable=False)
created_at: Mapped[datetime] = mapped_column(sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False)
updated_at: Mapped[datetime] = mapped_column(sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(), nullable=False)
position_links: Mapped[list["DepartmentPositionIndex"]] = relationship(
"DepartmentPositionIndex",
back_populates="department",
cascade="all, delete-orphan",
passive_deletes=True,
)
# Convenience: access positions directly (no secondary writes; uses association proxy)
positions = association_proxy("position_links", "position")

Xet Storage Details

Size:
2.71 kB
·
Xet hash:
54d13d7cb2ffe565433724f1f2822de43afa32f723226c308ce6f6cc9c078733

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.