SnowPro Associate: Platform Question 330
Single answer● COMPLETE functionA data engineering team is building an internal SQL assistant in Snowflake to help analysts draft queries against curated warehouse tables. They want to call Snowflake Cortex's COMPLETE function directly from SQL and include a prompt such as, "Write a SELECT statement that returns total sales by region for the last 30 days." The team also wants the solution to return generated text in the query result without creating a custom application outside Snowflake. Which approach best meets this requirement?
- A
Call SNOWFLAKE.CORTEX.COMPLETE with a supported model name and the prompt text in a SQL SELECT statement.
- B
Use the COMPLETE function only inside a COPY INTO command because Cortex functions cannot be invoked from standard SELECT queries.
- C
Create a Snowpipe pipeline that automatically converts prompts into SQL, because COMPLETE is available only through Snowpipe integrations.
- D
Use the COMPLETE function without specifying a model, because Snowflake automatically selects the best model based on the warehouse size.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to call SNOWFLAKE.CORTEX.COMPLETE directly in a SQL statement with a supported model name and a prompt. This is the practical way to generate text in-query using Snowflake Cortex. COMPLETE is intended for prompt-based text generation tasks such as summarization, drafting content, or generating SQL suggestions. It is not tied to Snowpipe, and it is not restricted to COPY INTO operations. A key implementation detail is that the caller must provide an appropriate supported model name as part of the function call. This aligns with Snowflake Cortex documentation and common best practice: invoke Cortex AISQL functions directly from SQL when you want model output returned as part of query processing inside Snowflake.
- A. Correct.
Correct. The COMPLETE function in Snowflake Cortex is designed to generate text from a prompt and can be invoked directly in SQL by specifying a supported model and the prompt. This matches the scenario because the team wants to generate output in query results from within Snowflake, without building an external app. A typical pattern is to use a SELECT statement that calls SNOWFLAKE.CORTEX.COMPLETE(model_name, prompt).
- B. Incorrect.
Incorrect. COMPLETE is not limited to COPY INTO. COPY INTO is used for loading or unloading data, not for invoking Cortex text-generation functions as the required mechanism. This distractor reflects a misunderstanding of where AI functions can be used in SQL workflows.
- C. Incorrect.
Incorrect. Snowpipe is used for continuous data ingestion, not for running prompt-based text generation with COMPLETE. Although Snowpipe and Cortex may both exist in a Snowflake environment, they serve different purposes. This option confuses data ingestion automation with LLM inference.
- D. Incorrect.
Incorrect. COMPLETE requires a supported model to be specified. Snowflake does not automatically choose a model based on warehouse size when calling the function. This distractor targets the misconception that warehouse compute settings determine LLM model selection.