Skip to main content

prefect.server.database.orm_models

Classes

Base

Base SQLAlchemy model that automatically infers the table name and provides ID, created, and updated columns

Flow

SQLAlchemy mixin of a flow.

FlowRunState

SQLAlchemy mixin of a flow run state. Methods:

as_state

data

TaskRunState

SQLAlchemy model of a task run state. Methods:

as_state

data

Artifact

SQLAlchemy model of artifacts.

ArtifactCollection

TaskRunStateCache

SQLAlchemy model of a task run state cache.

Run

Common columns and logic for FlowRun and TaskRun models Methods:

estimated_run_time

Total run time is incremented in the database whenever a RUNNING state is exited. To give up-to-date estimates, we estimate incremental run time for any runs currently in a RUNNING state.

estimated_start_time_delta

The delta to the expected start time (or “lateness”) is computed as the difference between the actual start time and expected start time. To give up-to-date estimates, we estimate lateness for any runs that don’t have a start time and are not in a final state and were expected to start already.

FlowRun

SQLAlchemy model of a flow run. Methods:

estimated_run_time

Total run time is incremented in the database whenever a RUNNING state is exited. To give up-to-date estimates, we estimate incremental run time for any runs currently in a RUNNING state.

estimated_start_time_delta

The delta to the expected start time (or “lateness”) is computed as the difference between the actual start time and expected start time. To give up-to-date estimates, we estimate lateness for any runs that don’t have a start time and are not in a final state and were expected to start already.

set_state

If a state is assigned to this run, populate its run id. This would normally be handled by the back-populated SQLAlchemy relationship, but because this is a one-to-one pointer to a one-to-many relationship, SQLAlchemy can’t figure it out.

state

TaskRun

SQLAlchemy model of a task run. Methods:

estimated_run_time

Total run time is incremented in the database whenever a RUNNING state is exited. To give up-to-date estimates, we estimate incremental run time for any runs currently in a RUNNING state.

estimated_start_time_delta

The delta to the expected start time (or “lateness”) is computed as the difference between the actual start time and expected start time. To give up-to-date estimates, we estimate lateness for any runs that don’t have a start time and are not in a final state and were expected to start already.

set_state

If a state is assigned to this run, populate its run id. This would normally be handled by the back-populated SQLAlchemy relationship, but because this is a one-to-one pointer to a one-to-many relationship, SQLAlchemy can’t figure it out.

state

DeploymentSchedule

Deployment

SQLAlchemy model of a deployment. Methods:

job_variables

Log

SQLAlchemy model of a logging statement.

ConcurrencyLimit

ConcurrencyLimitV2

BlockType

BlockSchema

BlockSchemaReference

BlockDocument

Methods:

decrypt_data

Retrieve decrypted data from the ORM model. Note: will only succeed if the caller has sufficient permission.

encrypt_data

Store encrypted data on the ORM model Note: will only succeed if the caller has sufficient permission.

BlockDocumentReference

Configuration

SavedSearch

SQLAlchemy model of a saved search.

WorkQueue

SQLAlchemy model of a work queue

WorkPool

SQLAlchemy model of an worker

Worker

SQLAlchemy model of an worker

Agent

SQLAlchemy model of an agent

Variable

FlowRunInput

CsrfToken

Automation

Methods:

sort_expression

Return an expression used to sort Automations

AutomationBucket

AutomationRelatedResource

CompositeTriggerChildFiring

AutomationEventFollower

Event

EventResource

BaseORMConfiguration

Abstract base class used to inject database-specific ORM configuration into Prefect. Modifications to core Prefect REST API data structures can have unintended consequences. Use with caution. Methods:

artifact_collection_unique_upsert_columns

Unique columns for upserting an ArtifactCollection

block_document_unique_upsert_columns

Unique columns for upserting a BlockDocument

block_schema_unique_upsert_columns

Unique columns for upserting a BlockSchema

block_type_unique_upsert_columns

Unique columns for upserting a BlockType

concurrency_limit_unique_upsert_columns

Unique columns for upserting a ConcurrencyLimit

deployment_unique_upsert_columns

Unique columns for upserting a Deployment

flow_run_unique_upsert_columns

Unique columns for upserting a FlowRun

flow_unique_upsert_columns

Unique columns for upserting a Flow

saved_search_unique_upsert_columns

Unique columns for upserting a SavedSearch

task_run_unique_upsert_columns

Unique columns for upserting a TaskRun

unique_key

Returns a key used to determine whether to instantiate a new DB interface.

versions_dir

Directory containing migrations

AsyncPostgresORMConfiguration

Postgres specific orm configuration Methods:

artifact_collection_unique_upsert_columns

Unique columns for upserting an ArtifactCollection

block_document_unique_upsert_columns

Unique columns for upserting a BlockDocument

block_schema_unique_upsert_columns

Unique columns for upserting a BlockSchema

block_type_unique_upsert_columns

Unique columns for upserting a BlockType

concurrency_limit_unique_upsert_columns

Unique columns for upserting a ConcurrencyLimit

deployment_unique_upsert_columns

Unique columns for upserting a Deployment

flow_run_unique_upsert_columns

Unique columns for upserting a FlowRun

flow_unique_upsert_columns

Unique columns for upserting a Flow

saved_search_unique_upsert_columns

Unique columns for upserting a SavedSearch

task_run_unique_upsert_columns

Unique columns for upserting a TaskRun

unique_key

Returns a key used to determine whether to instantiate a new DB interface.

versions_dir

Directory containing migrations

versions_dir

Directory containing migrations

AioSqliteORMConfiguration

SQLite specific orm configuration Methods:

artifact_collection_unique_upsert_columns

Unique columns for upserting an ArtifactCollection

block_document_unique_upsert_columns

Unique columns for upserting a BlockDocument

block_schema_unique_upsert_columns

Unique columns for upserting a BlockSchema

block_type_unique_upsert_columns

Unique columns for upserting a BlockType

concurrency_limit_unique_upsert_columns

Unique columns for upserting a ConcurrencyLimit

deployment_unique_upsert_columns

Unique columns for upserting a Deployment

flow_run_unique_upsert_columns

Unique columns for upserting a FlowRun

flow_unique_upsert_columns

Unique columns for upserting a Flow

saved_search_unique_upsert_columns

Unique columns for upserting a SavedSearch

task_run_unique_upsert_columns

Unique columns for upserting a TaskRun

unique_key

Returns a key used to determine whether to instantiate a new DB interface.

versions_dir

Directory containing migrations

versions_dir

Directory containing migrations