Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /MTSWebServices_data-rentgen /data_rentgen /db /models /input.py
| # SPDX-FileCopyrightText: 2024-present MTS PJSC | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from datetime import datetime | |
| from uuid import UUID | |
| from sqlalchemy import UUID as SQL_UUID | |
| from sqlalchemy import BigInteger, DateTime, ForeignKey, Index, PrimaryKeyConstraint | |
| from sqlalchemy.orm import Mapped, mapped_column, relationship | |
| from data_rentgen.db.models.base import Base | |
| from data_rentgen.db.models.dataset import Dataset | |
| from data_rentgen.db.models.job import Job | |
| from data_rentgen.db.models.operation import Operation | |
| from data_rentgen.db.models.run import Run | |
| from data_rentgen.db.models.schema import Schema | |
| # no foreign keys to partitioned tables | |
| class Input(Base): | |
| __tablename__ = "input" | |
| __table_args__ = ( | |
| # in most cases we filter rows by created_at, and never by id | |
| PrimaryKeyConstraint("created_at", "id"), | |
| Index("ix__input__schema_id", "schema_id", postgresql_where="schema_id IS NOT NULL"), | |
| {"postgresql_partition_by": "RANGE (created_at)"}, | |
| ) | |
| created_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), | |
| nullable=False, | |
| doc="Timestamp component of UUID, used for table partitioning", | |
| ) | |
| id: Mapped[UUID] = mapped_column(SQL_UUID) | |
| operation_id: Mapped[UUID] = mapped_column( | |
| SQL_UUID, | |
| index=True, | |
| nullable=False, | |
| doc="Operation caused this input", | |
| ) | |
| operation: Mapped[Operation] = relationship( | |
| Operation, | |
| primaryjoin="Input.operation_id == Operation.id", | |
| lazy="noload", | |
| foreign_keys=[operation_id], | |
| ) | |
| run_id: Mapped[UUID] = mapped_column( | |
| SQL_UUID, | |
| index=True, | |
| nullable=False, | |
| doc="Run caused this input operation", | |
| ) | |
| run: Mapped[Run] = relationship( | |
| Run, | |
| primaryjoin="Input.run_id == Run.id", | |
| lazy="noload", | |
| foreign_keys=[run_id], | |
| ) | |
| job_id: Mapped[int] = mapped_column( | |
| BigInteger, | |
| ForeignKey("job.id", ondelete="CASCADE"), | |
| index=True, | |
| nullable=False, | |
| doc="Parent job of run", | |
| ) | |
| job: Mapped[Job] = relationship( | |
| Job, | |
| primaryjoin="Input.job_id == Job.id", | |
| lazy="noload", | |
| foreign_keys=[job_id], | |
| ) | |
| dataset_id: Mapped[int] = mapped_column( | |
| BigInteger, | |
| ForeignKey("dataset.id", ondelete="CASCADE"), | |
| index=True, | |
| nullable=False, | |
| doc="Dataset the input is performed against", | |
| ) | |
| dataset: Mapped[Dataset] = relationship( | |
| Dataset, | |
| primaryjoin="Input.dataset_id == Dataset.id", | |
| lazy="noload", | |
| foreign_keys=[dataset_id], | |
| ) | |
| schema_id: Mapped[int | None] = mapped_column( | |
| BigInteger, | |
| ForeignKey("schema.id", ondelete="SET NULL"), | |
| nullable=True, | |
| doc="Schema the input is performed with, if any", | |
| ) | |
| schema: Mapped[Schema | None] = relationship( | |
| Schema, | |
| primaryjoin="Input.schema_id == Schema.id", | |
| lazy="noload", | |
| foreign_keys=[schema_id], | |
| ) | |
| num_bytes: Mapped[int | None] = mapped_column( | |
| BigInteger, | |
| nullable=True, | |
| doc="Amount of data moved during input, in bytes", | |
| ) | |
| num_rows: Mapped[int | None] = mapped_column( | |
| BigInteger, | |
| nullable=True, | |
| doc="Amount of data moved during input, in rows", | |
| ) | |
| num_files: Mapped[int | None] = mapped_column( | |
| BigInteger, | |
| nullable=True, | |
| doc="Amount of data moved during input, in rows", | |
| ) | |
Xet Storage Details
- Size:
- 3.53 kB
- Xet hash:
- 79818a21e2b70324c87268a75963ac8b11346694d8999500fb0f3cacfa5c28a5
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.