{"record":{"id":"0da200c881e2c39e","repo":"apache/beam","slug":"change-function-must-be-changes-or-appends-got-change","errorCode":null,"errorMessage":"change_function must be 'CHANGES' or 'APPENDS', got '{change_function}'","messagePattern":"change_function must be 'CHANGES' or 'APPENDS', got '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/bigquery_change_history.py","lineNumber":1214,"sourceCode":"      change_type_column: str = 'change_type',\n      change_timestamp_column: str = 'change_timestamp',\n      columns: Optional[list[str]] = None,\n      row_filter: Optional[str] = None,\n      batch_arrow_read: bool = True,\n      max_split_rounds: int = 1,\n      reshuffle_decompress: bool = True) -> None:\n    super().__init__()\n    if bq_storage is None:\n      raise ImportError(\n          'google-cloud-bigquery-storage is required for '\n          'ReadBigQueryChangeHistory. Install it with: '\n          'pip install google-cloud-bigquery-storage')\n    if pyarrow is None:\n      raise ImportError(\n          'pyarrow is required for ReadBigQueryChangeHistory. '\n          'Install it with: pip install pyarrow')\n    if change_function not in ('CHANGES', 'APPENDS'):\n      raise ValueError(\n          f\"change_function must be 'CHANGES' or 'APPENDS', \"\n          f\"got '{change_function}'\")\n    if poll_interval_sec < 15:\n      raise ValueError(\n          f'poll_interval_sec must be >= 15, got {poll_interval_sec}')\n    if buffer_sec < 0:\n      raise ValueError(f'buffer_sec must be >= 0, got {buffer_sec}')\n    self._table = table\n    self._poll_interval_sec = poll_interval_sec\n    self._start_time = start_time\n    self._stop_time = stop_time\n    self._change_function = change_function\n    self._buffer_sec = buffer_sec\n    self._project = project\n    self._temp_dataset = temp_dataset\n    self._location = location\n    self._change_type_column = change_type_column\n    self._change_timestamp_column = change_timestamp_column","sourceCodeStart":1196,"sourceCodeEnd":1232,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/bigquery_change_history.py#L1196-L1232","documentation":"ReadBigQueryChangeHistory only supports the BigQuery change-history functions 'CHANGES' and 'APPENDS'. Any other change_function string is rejected in __init__ with a ValueError that echoes the invalid value, because the generated change-history query syntax depends on this enum.","triggerScenarios":"Passing change_function='CHANGE' (singular), 'changes' (lowercase), 'INSERTUPDATEDELETE', or any other string outside ('CHANGES', 'APPENDS') when constructing ReadFromBigQueryChangeHistory.","commonSituations":"Typos or wrong casing when specifying the change function; confusing this option with BigQuery CDC terms like 'MERGE'; copying examples for different APIs.","solutions":["Set change_function='CHANGES' for row-level change history.","Set change_function='APPENDS' for append-only tables.","Use the exact uppercase spelling; the check is case-sensitive."],"exampleFix":"// before\nReadFromBigQueryChangeHistory(..., change_function=\"changes\")\n// after\nReadFromBigQueryChangeHistory(..., change_function=\"CHANGES\")","handlingStrategy":"validation","validationCode":"assert change_function in (\"CHANGES\", \"APPENDS\"), \\\n    f\"change_function must be 'CHANGES' or 'APPENDS', got {change_function!r}\"","typeGuard":"from typing import Literal\nChangeFunction = Literal[\"CHANGES\", \"APPENDS\"]","tryCatchPattern":"try:\n    transform = ReadFromBigQueryChangeHistory(..., change_function=fn)\nexcept ValueError as e:\n    log.error(\"invalid change_function: %s\", e)","preventionTips":["Use the exact uppercase strings 'CHANGES' or 'APPENDS'","Type the parameter as Literal['CHANGES','APPENDS'] in calling code","Watch for casing when the value originates from config files or CLI flags"],"tags":["python","apache-beam","bigquery","enum","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}