{"record":{"id":"66d6a430e5338171","repo":"apache/beam","slug":"create-disposition-has-to-be-one-of-the-following-values","errorCode":null,"errorMessage":"Create disposition has to be one of the following values:CREATE_IF_NEEDED, CREATE_NEVER. Got: {}","messagePattern":"Create disposition has to be one of the following values:CREATE_IF_NEEDED, CREATE_NEVER\\. Got: (.+?)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/snowflake.py","lineNumber":458,"sourceCode":"            self.expansion_service))\n\n\nclass CreateDisposition:\n  \"\"\"\n  Enum class for possible values of create dispositions:\n  CREATE_IF_NEEDED: default behaviour. The write operation checks whether\n  the specified target table exists; if it does not, the write operation\n  attempts to create the table Specify the schema for the target table\n  using the table_schema parameter.\n  CREATE_NEVER: The write operation fails if the target table does not exist.\n  \"\"\"\n  CREATE_IF_NEEDED = 'CREATE_IF_NEEDED'\n  CREATE_NEVER = 'CREATE_NEVER'\n\n  @staticmethod\n  def VerifyParam(field):\n    if field and not hasattr(CreateDisposition, field):\n      raise RuntimeError(\n          'Create disposition has to be one of the following values:'\n          'CREATE_IF_NEEDED, CREATE_NEVER. Got: {}'.format(field))\n\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","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/snowflake.py#L440-L476","documentation":"In Beam's Snowflake connector, CreateDisposition.VerifyParam checks that the given create-disposition string matches one of the class constants CREATE_IF_NEEDED or CREATE_NEVER. It raises RuntimeError when a truthy value does not correspond to any defined attribute, protecting against misspelled or unsupported disposition names.","triggerScenarios":"Passing a create_disposition value like 'create_if_needed' (wrong case), 'CREATE_IF_NESSED' (typo), or any string that is not exactly CREATE_IF_NEEDED / CREATE_NEVER to a Snowflake write transform.","commonSituations":"Copying Java Beam enum names with different casing, typos in pipeline options, or using a value valid in another connector but not Snowflake.","solutions":["Use the constant CreateDisposition.CREATE_IF_NEEDED or CreateDisposition.CREATE_NEVER instead of a raw string","Fix casing — values must be uppercase exactly as defined","Check for typos in the configured pipeline option","Pass None/empty to leave the disposition unset (verification is skipped when falsy)"],"exampleFix":"// before\nsnowflake.WriteToSnowflake(create_disposition='create_if_needed')\n// after\nfrom apache_beam.io.snowflake import CreateDisposition\nsnowflake.WriteToSnowflake(create_disposition=CreateDisposition.CREATE_IF_NEEDED)","handlingStrategy":"validation","validationCode":"from apache_beam.io.snowflake import CreateDisposition\nassert create_disposition in (None, '', CreateDisposition.CREATE_IF_NEEDED, CreateDisposition.CREATE_NEVER)","typeGuard":"def is_valid_create_disposition(v):\n    return not v or v in ('CREATE_IF_NEEDED', 'CREATE_NEVER')","tryCatchPattern":"try:\n    transform = snowflake.WriteToSnowflake(create_disposition=cd)\nexcept RuntimeError as e:\n    logger.error('Invalid create disposition: %s', e)","preventionTips":["Always use the CreateDisposition class constants, never raw strings","Validate pipeline options from config files against the enum values","Watch for case-sensitivity when values come from external configs"],"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"}