Formats parameters in operation in the way BigQuery expects.

    The input operation will be a query like ``SELECT %(namedparam)s`` and
    the output will be a query like ``SELECT @namedparam``.

    :type operation: str
    :param operation: A Google BigQuery query string.

    :type parameters: Mapping[str, Any]
    :param parameters: Dictionary of parameter values.

    :rtype: str
    :returns: A formatted query string.
    :raises: :class:`~google.cloud.bigquery.dbapi.ProgrammingError`
        if a parameter used in the operation is not found in the
        ``parameters`` argument.

def _format_operation_dict(operation, parameters):
    """Formats parameters in operation in the way BigQuery expects.

    The input operation will be a query like ``SELECT %(namedparam)s`` and
    the output will be a query like ``SELECT @namedparam``.

    :type operation: str
    :param operation: A Google BigQuery query string.

    :type parameters: Mapping[str, Any]
    :param parameters: Dictionary of parameter values.

    :rtype: str
    :returns: A formatted query string.
    :raises: :class:`~google.cloud.bigquery.dbapi.ProgrammingError`
        if a parameter used in the operation is not found in the
        ``parameters`` argument.
    """
    formatted_params = {}
    for name in parameters:
        escaped_name = name.replace("`", r"\`")
        formatted_params[name] = "@`{}`".format(escaped_name)

    try:
        return operation % formatted_params
    except KeyError as exc:
        raise exceptions.ProgrammingError(exc)