SnowPro Specialty: Gen AI Question 66
Single answerStored in YAML files in a stageA data engineering team wants to deploy a Snowflake Cortex Search Service definition using a YAML specification file that is versioned in Git and uploaded to an internal stage. They want a repeatable deployment process across environments without embedding the full object definition directly in SQL scripts. Which approach should they use to create the object from the YAML file stored in the stage?
- A
Use the CREATE CORTEX SEARCH SERVICE command and reference the staged YAML file with the FROM '@stage/path/spec.yaml' clause.
- B
Use EXECUTE IMMEDIATE on the YAML file in the stage, because Snowflake automatically parses YAML into DDL.
- C
Use CREATE CORTEX SEARCH SERVICE ... IMPORTS = ('@stage/path/spec.yaml') so the YAML file is treated as the service definition.
- D
Copy the YAML file from the stage into a VARIANT column, then call CREATE CORTEX SEARCH SERVICE USING VARIANT.
Show answer and explanation
Correct answer: A
Explanation
When Snowflake supports declarative object definitions in YAML files stored in a stage, the intended pattern is to keep the specification external to the SQL script and use the CREATE command with a FROM clause pointing to the staged YAML file. This is useful for CI/CD, environment promotion, and configuration-as-code practices. The key distinction is that Snowflake reads the YAML specification as an object definition through the documented CREATE ... FROM '@stage/path/file.yaml' pattern, rather than through dynamic SQL execution or generic file import features. Candidates should recognize the difference between staged configuration-driven creation and unrelated concepts such as EXECUTE IMMEDIATE, IMPORTS, or storing YAML in VARIANT.
- A. Correct.
Correct. For supported Snowflake objects that can be defined declaratively in YAML and stored in a stage, the object can be created by referencing the staged YAML file with a FROM clause in the CREATE statement. This supports a deployment workflow where the YAML spec is maintained externally, version-controlled, and promoted across environments.
- B. Incorrect.
Incorrect. EXECUTE IMMEDIATE executes SQL text, not YAML specifications. Snowflake does not automatically convert arbitrary YAML files in a stage into executable DDL through EXECUTE IMMEDIATE. Someone might choose this if they assume staged configuration files are interpreted as SQL at runtime.
- C. Incorrect.
Incorrect. IMPORTS is used in other Snowflake contexts, such as bringing supporting files into procedures or functions, but it is not the mechanism for using a staged YAML file as the object definition for a Cortex Search Service. This distractor reflects confusion between packaging artifacts and declarative object creation.
- D. Incorrect.
Incorrect. There is no CREATE CORTEX SEARCH SERVICE USING VARIANT syntax for supplying the service definition from a table column. While VARIANT can store semi-structured content, that is not the documented deployment mechanism for YAML-based object definitions stored in stages.