Repository: PrefectHQ/prefect
File: src/prefect/_experimental/plugins/spec.py (Python)

Code before:
    @hookspec
    def setup_environment(self, *, ctx: HookContext) -> Optional[SetupResult]:
        """
        Prepare process environment for Prefect and its children.

        This hook is called before Prefect CLI commands, workers, or agents
        start their main work. It allows plugins to configure environment
        variables, authenticate with external services, or perform other
        setup tasks.

        Args:
            ctx: Context object with Prefect version, API URL, and logger factory

        Returns:
            SetupResult with environment variables to set, or None to indicate
            no changes are needed.

        Important:
            - Must not print secrets or write sensitive data to disk by default
            - Should be idempotent
            - May be async or sync
            - Exceptions are caught and logged unless required=True in strict mode
        """

    @hookspec
    def get_database_connection_params(
        self, connection_url: str, settings: Any
    ) -> Mapping[str, Any]:
        """
        Get additional database connection parameters.

        This hook is called when creating a database engine. It allows plugins
        to provide additional connection parameters, such as authentication
        tokens or SSL configuration.

        Args:
            connection_url: The database connection URL
            settings: The current Prefect settings

        Returns:
            Dictionary of connection parameters to merge into connect_args
        """


Review comment (suggestion):
The name of this hook should be updated to communicate that it's making a change to the connection params.
```suggestion
    def set_database_connection_params(
```

Code after:
    def setup_environment(self, *, ctx: HookContext) -> Optional[SetupResult]:
        """
        Prepare process environment for Prefect and its children.

        This hook is called before Prefect CLI commands, workers, or agents
        start their main work. It allows plugins to configure environment
        variables, authenticate with external services, or perform other
        setup tasks.

        Args:
            ctx: Context object with Prefect version, API URL, and logger factory

        Returns:
            SetupResult with environment variables to set, or None to indicate
            no changes are needed.

        Important:
            - Must not print secrets or write sensitive data to disk by default
            - Should be idempotent
            - May be async or sync
            - Exceptions are caught and logged unless required=True in strict mode
        """

    @hookspec
    def set_database_connection_params(
        self, connection_url: str, settings: Any
    ) -> Mapping[str, Any]:
        """
        Set additional database connection parameters.

        This hook is called when creating a database engine. It allows plugins
        to provide additional connection parameters, such as authentication
        tokens or SSL configuration.

        Args:
            connection_url: The database connection URL
            settings: The current Prefect settings

        Returns:
            Dictionary of connection parameters to merge into connect_args
        """