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:
clear
on_close
on_close_detached
on_connect
track_pool
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:
begin_transaction
create_db
drop_db
engine
is_inmemory
session
unique_key
AsyncPostgresConfiguration
Methods:
begin_transaction
begin_transaction
create_db
create_db
drop_db
drop_db
engine
connection_url
: The database connection string. Defaults to self.connection_urlecho
: Whether to echo SQL sent to the database. Defaults to self.echotimeout
: The database statement timeout, in seconds. Defaults to self.timeout
- a SQLAlchemy engine
engine
is_inmemory
is_inmemory
schedule_engine_disposal
add_event_loop_shutdown_callback
.
We attempted to lazily clean up old engines when new engines are created, but
if the loop the engine is attached to is already closed then the connections
cannot be cleaned up properly and warnings are displayed.
Engine disposal should only be important when running the application
ephemerally. Notably, this is an issue in our tests where many short-lived event
loops and engines are created which can consume all of the available database
connection slots. Users operating at a scale where connection limits are
encountered should be encouraged to use a standalone server.
session
engine
: a sqlalchemy engine
session
unique_key
AioSqliteConfiguration
Methods:
begin_sqlite_conn
begin_sqlite_stmt
begin_transaction
begin_transaction
create_db
create_db
drop_db
drop_db
engine
connection_url
: The database connection string. Defaults to self.connection_urlecho
: Whether to echo SQL sent to the database. Defaults to self.echotimeout
: The database statement timeout, in seconds. Defaults to self.timeout
- a SQLAlchemy engine
engine
is_inmemory
is_inmemory
schedule_engine_disposal
add_event_loop_shutdown_callback
.
We attempted to lazily clean up old engines when new engines are created, but
if the loop the engine is attached to is already closed then the connections
cannot be cleaned up properly and warnings are displayed.
Engine disposal should only be important when running the application
ephemerally. Notably, this is an issue in our tests where many short-lived event
loops and engines are created which can consume all of the available database
connection slots. Users operating at a scale where connection limits are
encountered should be encouraged to use a standalone server.
session
engine
: a sqlalchemy engine