SnowPro Specialty: Gen AI Question 179
Single answer2.4 Use Snowflake Cortex functions in data pipelines.A retail company stores raw customer reviews in a Snowflake table and wants to enrich each review in a daily ELT pipeline before analysts query the curated layer. The pipeline must generate a sentiment label and a short summary directly in Snowflake, avoid moving data to external services, and write the results into a downstream table using SQL. Which approach BEST meets these requirements?
- A
Create a SQL transformation that reads from the raw reviews table, calls Snowflake Cortex functions such as SENTIMENT and SUMMARIZE on the review text, and inserts the generated outputs into the curated table as part of the pipeline.
- B
Export the raw reviews from Snowflake to an external application, call a third-party LLM API for sentiment and summarization, and reload the enriched data into Snowflake because Cortex functions cannot be used in SQL pipelines.
- C
Train a custom Snowpark ML model inside the pipeline because Snowflake Cortex functions are only for interactive chat use cases and cannot process table data.
- D
Use a task that copies the review text into a new table unchanged, then ask analysts to run ad hoc prompts later, because Cortex functions cannot be persisted as part of ELT output tables.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use Snowflake Cortex functions directly in SQL transformations within the ELT pipeline. Snowflake Cortex supports in-database AI inference on Snowflake data, which is a key design advantage for production pipelines that need to enrich text without exporting data. For this use case, a SQL statement can read review text from a source table, apply functions such as SENTIMENT and SUMMARIZE, and insert the resulting attributes into a target table. This pattern aligns with Snowflake best practices for keeping data processing close to the data, reducing unnecessary movement, and operationalizing AI enrichments in repeatable pipelines. The incorrect answers are based on common misunderstandings: that Cortex cannot be used in SQL, that it is only for interactive chat, or that its outputs cannot be persisted. Snowflake documentation for Cortex AI functions describes SQL-based invocation and use in standard data workflows, including transformations over table data.
- A. Correct.
Correct. Snowflake Cortex functions are designed to be called directly in SQL and can be embedded in data pipeline transformations. In this scenario, using functions such as SENTIMENT for classification and SUMMARIZE for concise summaries allows the company to enrich text in-place within Snowflake and persist the outputs into a curated table. This approach satisfies all stated requirements: keep data in Snowflake, use SQL, and store results for downstream analytics.
- B. Incorrect.
Incorrect. This is a plausible architecture in some environments, but it does not best meet the requirement to avoid moving data to external services. It is also based on a false premise: Cortex functions can be used directly in SQL workflows inside Snowflake, including transformations that populate downstream tables.
- C. Incorrect.
Incorrect. This option reflects a common misconception that Cortex is limited to chat experiences. In reality, Cortex provides SQL functions for inference tasks that can operate on data in tables. Training a custom model is also unnecessary for the stated requirement, which only needs standard enrichment tasks such as sentiment analysis and summarization.
- D. Incorrect.
Incorrect. Cortex outputs can be generated and persisted during ELT processing; they are not limited to temporary or analyst-driven interactive usage. While ad hoc prompting may be useful for exploration, it does not satisfy the requirement to enrich data in the daily pipeline and write results into a downstream curated table.