{"record":{"id":"b54fda033c3bb3f0","repo":"apache/beam","slug":"write-disposition-has-to-be-one-of-the-following-values","errorCode":null,"errorMessage":"Write disposition has to be one of the following values:APPEND, EMPTY, TRUNCATE. Got: {}","messagePattern":"Write disposition has to be one of the following values:APPEND, EMPTY, TRUNCATE\\. Got: (.+?)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/snowflake.py","lineNumber":479,"sourceCode":"\n\nclass WriteDisposition:\n  \"\"\"\n  Enum class for possible values of write dispositions:\n  APPEND: Default behaviour. Written data is added to the existing rows\n  in the table,\n  EMPTY: The target table must be empty;  otherwise, the write operation fails,\n  TRUNCATE: The write operation deletes all rows from the target table\n  before writing to it.\n  \"\"\"\n  APPEND = 'APPEND'\n  EMPTY = 'EMPTY'\n  TRUNCATE = 'TRUNCATE'\n\n  @staticmethod\n  def VerifyParam(field):\n    if field and not hasattr(WriteDisposition, field):\n      raise RuntimeError(\n          'Write disposition has to be one of the following values:'\n          'APPEND, EMPTY, TRUNCATE. Got: {}'.format(field))\n\n\ndef verify_credentials(\n    username, password, private_key_path, raw_private_key, o_auth_token):\n  if not (o_auth_token or (username and password) or\n          (username and (private_key_path or raw_private_key))):\n    raise RuntimeError('Snowflake credentials are not set correctly.')\n","sourceCodeStart":461,"sourceCodeEnd":489,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/snowflake.py#L461-L489","documentation":"In Beam's Snowflake connector, WriteDisposition.VerifyParam checks that the write-disposition string is one of the class constants APPEND, EMPTY, or TRUNCATE. It raises RuntimeError when a truthy value matches no defined attribute, preventing invalid Snowflake table write modes.","triggerScenarios":"Passing a write_disposition like 'append' (wrong case), 'OVERWRITE' (not supported), or any misspelled string to a Snowflake write transform.","commonSituations":"Translating SQL-style or other-connector dispositions (e.g. 'OVERWRITE' instead of 'TRUNCATE'), or lowercase config values from environment/YAML files.","solutions":["Use WriteDisposition.APPEND, WriteDisposition.EMPTY, or WriteDisposition.TRUNCATE constants","Fix casing — the string must exactly match the uppercase constant name","Replace unsupported synonyms like OVERWRITE with TRUNCATE","Pass None/empty to leave the disposition unset (verification is skipped when falsy)"],"exampleFix":"// before\nsnowflake.WriteToSnowflake(write_disposition='overwrite')\n// after\nfrom apache_beam.io.snowflake import WriteDisposition\nsnowflake.WriteToSnowflake(write_disposition=WriteDisposition.TRUNCATE)","handlingStrategy":"validation","validationCode":"from apache_beam.io.snowflake import WriteDisposition\nassert write_disposition in (None, '', WriteDisposition.APPEND, WriteDisposition.EMPTY, WriteDisposition.TRUNCATE)","typeGuard":"def is_valid_write_disposition(v):\n    return not v or v in ('APPEND', 'EMPTY', 'TRUNCATE')","tryCatchPattern":"try:\n    transform = snowflake.WriteToSnowflake(write_disposition=wd)\nexcept RuntimeError as e:\n    logger.error('Invalid write disposition: %s', e)","preventionTips":["Use WriteDisposition constants instead of string literals","Map synonyms (OVERWRITE -> TRUNCATE) when importing configs","Keep enum values uppercase in YAML/env configuration"],"tags":["apache-beam","python","snowflake","enum"],"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-20T03:17:13.778Z"}