Get the current Prefect REST API database interface.If components of the interface are not set, defaults will be inferred
based on the dialect of the connection URL.
Decorator that provides a database interface to a function.The decorated function must take a db kwarg and if a db is passed
when called it will be used instead of creating a new one.
Decorator to inject a PrefectDBInterface instance as the first positional
argument to the decorated function.Unlike inject_db, which injects the database connection as a keyword
argument, db_injector adds it explicitly as the first positional
argument. This change enhances type hinting by making the dependency on
PrefectDBInterface explicit in the function signature.When decorating a coroutine function, the result will continue to pass the
iscoroutinefunction() test.Args:
func: The function or method to decorate.
Returns:
A wrapped descriptor object which injects the PrefectDBInterface instance
as the first argument to the function or method. This handles method
Temporarily override the Prefect REST API database configuration.
When the context is closed, the existing database configuration will
be restored.Args:
tmp_database_config: Prefect REST API database configuration to inject.
Temporarily override the Prefect REST API database interface.Any interface components that are not explicitly provided will be
cleared and inferred from the Prefect REST API database connection string
dialect.When the context is closed, the existing database interface will
be restored.Args:
tmp_database_config: An optional Prefect REST API database configuration to inject.
tmp_orm_config: An optional Prefect REST API ORM configuration to inject.
tmp_queries: Optional Prefect REST API query components to inject.
tmp_interface_class: Optional database interface class to inject