Repository: PrefectHQ/prefect
File: src/prefect/settings/models/server/database.py (Python)

Code before:
        description="Controls the application_name field for connections opened from the connection pool when using a PostgreSQL database with the Prefect backend.",
    )

    statement_cache_size: Optional[int] = Field(
        default=None,
        description="Controls statement cache size for PostgreSQL connections. Setting this to 0 is required when using PgBouncer in transaction mode. Defaults to None.",
    )

    prepared_statement_cache_size: Optional[int] = Field(
        default=None,
        description=(
            "Controls the size of the statement cache for PostgreSQL connections. "
            "When set to 0, statement caching is disabled. Defaults to None to use "
            "SQLAlchemy's default behavior."
        ),
    )

    tls: SQLAlchemyTLSSettings = Field(
        default_factory=SQLAlchemyTLSSettings,
        description="Settings for controlling SQLAlchemy mTLS behavior",
    )

    iam: SQLAlchemyIAMSettings = Field(
        default_factory=SQLAlchemyIAMSettings,
        description="Settings for controlling IAM authentication for PostgreSQL connections.",
    )


class SQLAlchemySettings(PrefectBaseSettings):
    """
    Settings for controlling SQLAlchemy behavior; note that these settings only take effect when
    using a PostgreSQL database.
    """

    model_config: ClassVar[SettingsConfigDict] = build_settings_config(
        ("server", "database", "sqlalchemy")
    )

    connect_args: SQLAlchemyConnectArgsSettings = Field(
        default_factory=SQLAlchemyConnectArgsSettings,
        description="Settings for controlling SQLAlchemy connection behavior",
    )

    pool_size: int = Field(
        default=5,
        description="Controls connection pool size of database connection pools from the Prefect backend.",
        validation_alias=AliasChoices(
            AliasPath("pool_size"),
            "prefect_server_database_sqlalchemy_pool_size",
            "prefect_sqlalchemy_pool_size",
        ),

Review comment (suggestion):
Since these settings are only used in `prefect-aws`, I think these settings should be moved to `prefect_aws.settings`.

Code after:
    )


class SQLAlchemySettings(PrefectBaseSettings):
    """
    Settings for controlling SQLAlchemy behavior; note that these settings only take effect when
    using a PostgreSQL database.
    """

    model_config: ClassVar[SettingsConfigDict] = build_settings_config(
        ("server", "database", "sqlalchemy")
    )

    connect_args: SQLAlchemyConnectArgsSettings = Field(
        default_factory=SQLAlchemyConnectArgsSettings,
        description="Settings for controlling SQLAlchemy connection behavior",
    )

    pool_size: int = Field(
        default=5,
        description="Controls connection pool size of database connection pools from the Prefect backend.",
        validation_alias=AliasChoices(
            AliasPath("pool_size"),
            "prefect_server_database_sqlalchemy_pool_size",
            "prefect_sqlalchemy_pool_size",
        ),
    )

    pool_recycle: int = Field(
        default=3600,
        description="This setting causes the pool to recycle connections after the given number of seconds has passed; set it to -1 to avoid recycling entirely.",
    )

    pool_timeout: Optional[float] = Field(
        default=30.0,
        description="Number of seconds to wait before giving up on getting a connection from the pool. Defaults to 30 seconds.",
    )

    max_overflow: int = Field(
        default=10,
        description="Controls maximum overflow of the connection pool. To prevent overflow, set to -1.",
        validation_alias=AliasChoices(
            AliasPath("max_overflow"),
            "prefect_server_database_sqlalchemy_max_overflow",
            "prefect_sqlalchemy_max_overflow",
        ),
    )


class ServerDatabaseSettings(PrefectBaseSettings):
    """