Skip to main content

schema

SQLAlchemy ORM for the runs 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 runs 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

Run

class Run(**kwargs):

SQLAlchemy model for the runs cache table.

Tracks the lifecycle of flow executions. Multiple rows per task hash are allowed — each run attempt is a distinct row identified by (task_hash, run_id).

The type column is a free-form run-kind discriminator (e.g. "file_metadata", "interactive", a DAG name, or a node name). The duplicate-run guard in mark_run_started / _is_run_active is scoped by (task_hash, type), so the value must be specific enough that two runs sharing it are genuinely mutually-exclusive duplicates — runs of different types for the same task_hash may legally run in parallel.

parent_run_id supports hierarchical runs: a DAG-level run has parent_run_id = None, and each node-level run within that DAG carries the DAG run's run_id as its parent_run_id while getting its own unique run_id.

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

  • completed_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • error : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • files_processed : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • parent_run_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • project_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • run_id : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • started_at : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]
  • status : 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]
  • type : Union[sqlalchemy.orm.attributes.InstrumentedAttribute[+_T_co], +_T_co]