Skip to main content

schema

SQLAlchemy ORM for the model_inferences cache table (v2).

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 model_inferences v2.

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

ModelInference

class ModelInference(**kwargs):

SQLAlchemy model for the model_inferences cache table.

A single table for all model inference results. The model_ref column distinguishes which model produced the inferences (e.g. "FoveaCenterLandmarkDetectionModel", "AltrisConfigurablePathologyModel").

Because different models produce different output columns (and some, like Altris, are configurable at runtime), the actual inference data is stored as a JSON blob in inferences_json.

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

  • error : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • file_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • inferences_json : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • last_accessed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • model_ref : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • model_version : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • processed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • project_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • row_number : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • run_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • source_file_hash : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • tags : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • task_hash : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]