def METHOD_NAME(cls, v: str, values: dict[str, Any]) -> Any:
    """Build Postgres connection from environment variables."""
    if isinstance(v, str):
        return v
    if not (user := values.get("FMTM_DB_USER")):
        raise ValueError("FMTM_DB_USER is not present in the environment")
    if not (password := values.get("FMTM_DB_PASSWORD")):
        raise ValueError("FMTM_DB_PASSWORD is not present in the environment")
    if not (host := values.get("FMTM_DB_HOST")):
        raise ValueError("FMTM_DB_HOST is not present in the environment")
    return PostgresDsn.build(
        scheme="postgresql",
        user=user,
        password=password,
        host=host,
        path=f"/{values.get('FMTM_DB_NAME') or ''}",
    )