snowflake.core.service.ServiceSpec

snowflake.core.service.ServiceSpec(spec: str, force_inline: bool = False) → ServiceSpecInlineText | ServiceSpecStageFile

Infer whether a specification is a stage file or inline text.

Any spec that starts with ‘@’ is parsed as a stage file, otherwise it is passed as an inline text.

Note: this function infers inline-text vs. stage-file handling from the first character of spec. If spec may contain untrusted input and your application expects the inline-text branch, pass force_inline=True to guarantee inline-text handling regardless of the string’s content, while still getting this function’s YAML validation and normalization.

Parameters:
  • spec (str) – The specification to parse, either a stage file path prefixed with '@' or inline YAML text.

  • force_inline (bool, optional) – If True, always treat spec as inline text and validate it as such, even if it starts with '@'. Defaults to False.

Returns:

A ServiceSpecStageFile if spec starts with '@' and force_inline is False, otherwise a ServiceSpecInlineText.

Return type:

Union[ServiceSpecInlineText, ServiceSpecStageFile]