prefect.server.database.configurations

Classes

ConnectionTracker

A test utility which tracks the connections given out by a connection pool, to make it easy to see which connections are currently checked out and open.

Methods:

track_pool

track_pool(self, pool: sa.pool.Pool) -> None

on_connect

on_connect(self, adapted_connection: AdaptedConnection, connection_record: ConnectionPoolEntry) -> None

on_close

on_close(self, adapted_connection: AdaptedConnection, connection_record: ConnectionPoolEntry) -> None

on_close_detached

on_close_detached(self, adapted_connection: AdaptedConnection) -> None

clear

clear(self) -> None

BaseDatabaseConfiguration

Abstract base class used to inject database connection configuration into Prefect.

This configuration is responsible for defining how Prefect REST API creates and manages database connections and sessions.

Methods:

unique_key

unique_key(self) -> tuple[Hashable, ...]

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

is_inmemory

is_inmemory(self) -> bool

Returns true if database is run in memory

begin_transaction

begin_transaction(self, session: AsyncSession, with_for_update: bool = False) -> AbstractAsyncContextManager[AsyncSessionTransaction]

Enter a transaction for a session

AsyncPostgresConfiguration

Methods:

is_inmemory

is_inmemory(self) -> bool

Returns true if database is run in memory

AioSqliteConfiguration

Methods:

setup_sqlite

setup_sqlite(self, conn: DBAPIConnection, record: ConnectionPoolEntry) -> None

Issue PRAGMA statements to SQLITE on connect. PRAGMAs only last for the duration of the connection. See https://www.sqlite.org/pragma.html for more info.

begin_sqlite_conn

begin_sqlite_conn(self, conn: aiosqlite.AsyncAdapt_aiosqlite_connection) -> None

begin_sqlite_stmt

begin_sqlite_stmt(self, conn: sa.Connection) -> None

is_inmemory

is_inmemory(self) -> bool

Returns true if database is run in memory