prefect.server.database.interface

Classes

DBSingleton

Ensures that only one database interface is created per unique key

PrefectDBInterface

An interface for backend-specific SqlAlchemy actions and ORM models. The REST API can be configured to run against different databases in order maintain performance at different scales. This interface integrates database- and dialect- specific configuration into a unified interface that the orchestration engine runs against. Methods:

Agent

Agent(self) -> type[orm_models.Agent]
An agent model

Artifact

Artifact(self) -> type[orm_models.Artifact]
An artifact orm model

ArtifactCollection

ArtifactCollection(self) -> type[orm_models.ArtifactCollection]
An artifact collection orm model

Automation

Automation(self) -> type[orm_models.Automation]
An automation model

AutomationBucket

AutomationBucket(self) -> type[orm_models.AutomationBucket]
An automation bucket model

AutomationEventFollower

AutomationEventFollower(self) -> type[orm_models.AutomationEventFollower]
A model capturing one event following another event

AutomationRelatedResource

AutomationRelatedResource(self) -> type[orm_models.AutomationRelatedResource]
An automation related resource model

Base

Base(self) -> type[orm_models.Base]
Base class for orm models

BlockDocument

BlockDocument(self) -> type[orm_models.BlockDocument]
A block document model

BlockDocumentReference

BlockDocumentReference(self) -> type[orm_models.BlockDocumentReference]
A block document reference model

BlockSchema

BlockSchema(self) -> type[orm_models.BlockSchema]
A block schema model

BlockSchemaReference

BlockSchemaReference(self) -> type[orm_models.BlockSchemaReference]
A block schema reference model

BlockType

BlockType(self) -> type[orm_models.BlockType]
A block type model

CompositeTriggerChildFiring

CompositeTriggerChildFiring(self) -> type[orm_models.CompositeTriggerChildFiring]
A model capturing a composite trigger’s child firing

ConcurrencyLimit

ConcurrencyLimit(self) -> type[orm_models.ConcurrencyLimit]
A concurrency model

ConcurrencyLimitV2

ConcurrencyLimitV2(self) -> type[orm_models.ConcurrencyLimitV2]
A v2 concurrency model

Configuration

Configuration(self) -> type[orm_models.Configuration]
An configuration model

CsrfToken

CsrfToken(self) -> type[orm_models.CsrfToken]
A csrf token model

Deployment

Deployment(self) -> type[orm_models.Deployment]
A deployment orm model

DeploymentSchedule

DeploymentSchedule(self) -> type[orm_models.DeploymentSchedule]
A deployment schedule orm model

Event

Event(self) -> type[orm_models.Event]
An event model

EventResource

EventResource(self) -> type[orm_models.EventResource]
An event resource model

Flow

Flow(self) -> type[orm_models.Flow]
A flow orm model

FlowRun

FlowRun(self) -> type[orm_models.FlowRun]
A flow run orm model

FlowRunInput

FlowRunInput(self) -> type[orm_models.FlowRunInput]
A flow run input model

FlowRunState

FlowRunState(self) -> type[orm_models.FlowRunState]
A flow run state orm model

Log

Log(self) -> type[orm_models.Log]
A log orm model

SavedSearch

SavedSearch(self) -> type[orm_models.SavedSearch]
A saved search orm model

TaskRun

TaskRun(self) -> type[orm_models.TaskRun]
A task run orm model

TaskRunState

TaskRunState(self) -> type[orm_models.TaskRunState]
A task run state orm model

TaskRunStateCache

TaskRunStateCache(self) -> type[orm_models.TaskRunStateCache]
A task run state cache orm model

Variable

Variable(self) -> type[orm_models.Variable]
A variable model

WorkPool

WorkPool(self) -> type[orm_models.WorkPool]
A work pool orm model

WorkQueue

WorkQueue(self) -> type[orm_models.WorkQueue]
A work queue model

Worker

Worker(self) -> type[orm_models.Worker]
A worker process orm model

create_db

create_db(self) -> None
Create the database

dialect

dialect(self) -> type[sa.engine.Dialect]

drop_db

drop_db(self) -> None
Drop the database

engine

engine(self) -> AsyncEngine
Provides a SqlAlchemy engine against a specific database.

is_db_connectable

is_db_connectable(self) -> bool
Returns boolean indicating if the database is connectable. This method is used to determine if the server is ready to accept requests.

run_migrations_downgrade

run_migrations_downgrade(self, revision: str = '-1') -> None
Run all downgrade migrations

run_migrations_upgrade

run_migrations_upgrade(self) -> None
Run all upgrade migrations

session

session(self) -> AsyncSession
Provides a SQLAlchemy session.

session_context

session_context(self, begin_transaction: bool = False, with_for_update: bool = False)
Provides a SQLAlchemy session and a context manager for opening/closing the underlying connection. Args:
  • begin_transaction: if True, the context manager will begin a SQL transaction. Exiting the context manager will COMMIT or ROLLBACK any changes.