apache/beam · error · ValueError

Unsupported query configuration type

Error message

Unsupported query configuration type

What it means

_extract_values_from_request pulls where-clause values from the incoming beam.Row based on the active query config; if the config matches none of the supported isinstance branches, it raises ValueError('Unsupported query configuration type').

Solutions

  1. Use one of the supported configs: CustomQueryConfig, TableFieldsQueryConfig, or TableFunctionQueryConfig.
  2. If a custom config is needed, extend the handler's extraction logic instead of inventing a new QueryConfig type.
  3. Log type(self._query_config) to confirm what is actually being passed.

Example fix

# before
handler = CloudSQLEnrichmentHandler(query_config=MyCustomQueryConfig(...), connection_config=cfg)
# after
handler = CloudSQLEnrichmentHandler(query_config=TableFunctionQueryConfig(...), connection_config=cfg)
Defensive patterns

Strategy: validation

When it happens

Trigger: Passing a custom/unknown QueryConfig subclass (or a config outside CustomQueryConfig/TableFields/TableFunction) to CloudSQLEnrichmentHandler so the isinstance chain matches nothing.

Common situations: Implementing a custom QueryConfig subclass and passing it to the handler; factory code returning the wrong config type; version drift introducing a new config type not handled here.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

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

    Returns:
      List of parameter values

    Raises:
      KeyError: If required fields are missing from the request
    """
    try:
      if isinstance(self._query_config, TableFunctionQueryConfig):
        return [
            val for val in self._query_config.where_clause_value_fn(request)
        ]
      elif isinstance(self._query_config, TableFieldsQueryConfig):
        request_dict = request._asdict()
        return [
            request_dict[field]
            for field in self._query_config.where_clause_fields
        ]
      else:
        raise ValueError("Unsupported query configuration type")
    except KeyError as e:
      raise KeyError(
          "Make sure the values passed in `where_clause_fields` are "
          "the keys in the input `beam.Row`." + str(e))

  def _extract_parameter_names(self, template: str) -> list[str]:
    """Extract parameter names from a SQL template string.

    Args:
      template: SQL template string with named parameters (e.g., "id = :id")

    Returns:
      List of parameter names found in the template (e.g., ["id"])
    """
    return re.findall(r':(\w+)', template)

  def create_row_key(self, row: beam.Row):
    if isinstance(self._query_config, TableFunctionQueryConfig):

View on GitHub (pinned to 12126d8942)