{"record":{"id":"01f9de3484035ce9","repo":"apache/beam","slug":"parameter-binding-not-supported-for-type-self-query-config","errorCode":null,"errorMessage":"Parameter binding not supported for {type(self._query_config).__name__}","messagePattern":"Parameter binding not supported for (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql.py","lineNumber":512,"sourceCode":"          param_dict[f'batch_{i}_{param_name}'] = val\n      else:\n        single_param_dict = self._build_single_param_dict(current_values)\n        param_dict.update(single_param_dict)\n\n    return param_dict\n\n  def _build_single_param_dict(self, values: list[Any]) -> dict[str, Any]:\n    \"\"\"Build parameter dictionary for single request processing.\n\n    Args:\n      values: List of parameter values\n\n    Returns:\n      Dictionary mapping parameter names to values\n    \"\"\"\n    table_query_configs = (TableFieldsQueryConfig, TableFunctionQueryConfig)\n    if not isinstance(self._query_config, table_query_configs):\n      raise ValueError(\n          f\"Parameter binding not supported for \"\n          f\"{type(self._query_config).__name__}\")\n\n    _, param_dict = self._get_unique_template_and_params(\n        self._query_config.where_clause_template, values)\n    return param_dict\n\n  def _get_unique_template_and_params(\n      self, template: str, values: list[Any]) -> tuple[str, dict[str, Any]]:\n    \"\"\"Generate unique binding parameter names for duplicate templates.\n\n    Args:\n      template: SQL template with potentially duplicate binding parameter names\n      values: List of parameter values\n\n    Returns:\n      Tuple of (updated_template, param_dict) with unique binding names.\n    \"\"\"","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql.py#L494-L530","documentation":"_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.","triggerScenarios":"Using CustomQueryConfig on a code path that resolves per-request parameters (_build_single_param_dict via _process_single_request or _build_parameters_dict).","commonSituations":"Switching from TableFieldsQueryConfig to CustomQueryConfig while keeping parameterized template syntax like {id}; assuming CustomQueryConfig supports named placeholders.","solutions":["Use TableFieldsQueryConfig or TableFunctionQueryConfig when parameter binding on where fields is needed.","For CustomQueryConfig, supply fully literal/static SQL values.","Align the query config type with the enrichment call path that builds parameters."],"exampleFix":"# before\nquery_config = CustomQueryConfig(query=\"SELECT * FROM users WHERE id = {id}\")\n# after\nquery_config = TableFieldsQueryConfig(table_name=\"users\", table_fields=[\"id\"], where_clause_template=\"id = {id}\", where_clause_fields=[\"id\"])","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["python","configuration","cloudsql","parameter-binding"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}