INNER CODE UNIT · Python

get_database_migration_plugin

litestar-org/advanced-alchemy · advanced_alchemy/extensions/flask/cli.py:20

def get_database_migration_plugin(app: "Flask") -> "AdvancedAlchemy":
    """Retrieve the Advanced Alchemy extension from the Flask application.

    Args:
        app: The :class:`flask.Flask` application instance.

    Returns:
        :class:`AdvancedAlchemy`: The Advanced Alchemy extension instance.

    Raises:
        :exc:`advanced_alchemy.exceptions.ImproperConfigurationError`: If the extension is not found.
    """
    from advanced_alchemy.exceptions import ImproperConfigurationError

    with suppress(KeyError):
        return cast("AdvancedAlchemy", app.extensions["advanced_alchemy"])
    msg = "Failed to initialize database migrations. The Advanced Alchemy extension is not properly configured."
    raise ImproperConfigurationError(msg)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…