Skip to main content

schema

SQLAlchemy ORM for the dataset_scopes cache table (v1).

Each version package declares its own local Base (its own MetaData) so that multiple versions of the same table can coexist in one process without a __tablename__ collision. Base carries the shared nullable tags column and every ORM in this version inherits it directly.

Adding a column to a new version is an additive migration (see migrations.py): add a nullable mapped_column in the new version's schema and a corresponding upgrade step — never rename/drop/retype in place.

Classes​

Base​

class Base(**kwargs: Any):

Local declarative base for dataset_scopes v1.

Owns an isolated MetaData (so it never collides with another version of this table) and inherits the shared columns from types/schema.py's Base.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Subclasses​

Variables​

  • static metadata
  • static registry

DatasetScopeRow​

class DatasetScopeRow(**kwargs):

SQLAlchemy model for the dataset_scopes cache table.

One row per file in a dataset's latest saved scope for a trial. A dataset's rows are replaced together; no rows means no scope has been saved for it. An empty saved scope (the dataset's run selected no file) is one row whose file_path is "", which the store writes and reads and never returns as a file.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Variables​

  • datasource_task_hash : sqlalchemy.orm.base.Mapped[str]
  • file_path : sqlalchemy.orm.base.Mapped[str]
  • project_id : sqlalchemy.orm.base.Mapped[str]
  • run_id : sqlalchemy.orm.base.Mapped[str | None]
  • saved_at : sqlalchemy.orm.base.Mapped[str]
  • tags : sqlalchemy.orm.base.Mapped[dict[str, typing.Any] | None]