apache/beam · error · ValueError

Parameter binding not supported for

Error message

Parameter binding not supported for {type(self._query_config).__name__}

What it means

_build_single_param_dict converts a where_clause_template into bound parameters, but only TableFieldsQueryConfig and TableFunctionQueryConfig support parameter binding. For any other config type (notably CustomQueryConfig) it raises ValueError.

Solutions

  1. Use TableFieldsQueryConfig or TableFunctionQueryConfig when parameter binding on where fields is needed.
  2. For CustomQueryConfig, supply fully literal/static SQL values.
  3. Align the query config type with the enrichment call path that builds parameters.

Example fix

# before
query_config = CustomQueryConfig(query="SELECT * FROM users WHERE id = {id}")
# after
query_config = TableFieldsQueryConfig(table_name="users", table_fields=["id"], where_clause_template="id = {id}", where_clause_fields=["id"])
Defensive patterns

Strategy: validation

When it happens

Trigger: Using CustomQueryConfig on a code path that resolves per-request parameters (_build_single_param_dict via _process_single_request or _build_parameters_dict).

Common situations: Switching from TableFieldsQueryConfig to CustomQueryConfig while keeping parameterized template syntax like {id}; assuming CustomQueryConfig supports named placeholders.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/01f9de3484035ce9. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql.py:512

          param_dict[f'batch_{i}_{param_name}'] = val
      else:
        single_param_dict = self._build_single_param_dict(current_values)
        param_dict.update(single_param_dict)

    return param_dict

  def _build_single_param_dict(self, values: list[Any]) -> dict[str, Any]:
    """Build parameter dictionary for single request processing.

    Args:
      values: List of parameter values

    Returns:
      Dictionary mapping parameter names to values
    """
    table_query_configs = (TableFieldsQueryConfig, TableFunctionQueryConfig)
    if not isinstance(self._query_config, table_query_configs):
      raise ValueError(
          f"Parameter binding not supported for "
          f"{type(self._query_config).__name__}")

    _, param_dict = self._get_unique_template_and_params(
        self._query_config.where_clause_template, values)
    return param_dict

  def _get_unique_template_and_params(
      self, template: str, values: list[Any]) -> tuple[str, dict[str, Any]]:
    """Generate unique binding parameter names for duplicate templates.

    Args:
      template: SQL template with potentially duplicate binding parameter names
      values: List of parameter values

    Returns:
      Tuple of (updated_template, param_dict) with unique binding names.
    """

View on GitHub (pinned to 12126d8942)