A Data Analyst created a model called modelX using SNOWFLAKE.ML.FORECAST. The Analyst needs to predict the next few values and save the result directly into tableX. What step does the Analyst need to take after calling the modelX!FORECAST function?
A.
Load the function call results directly INTO tableX.
B.
Pass the new table as a function argument.
C.
Create the table by querying the RESULT_SCAN.
D.
List the cache content, then use the data saved in the RESULT_SCAN for tableX.
Snowflake Cortex ML functions, such as FORECAST, return a tabular result set when called using the instance method syntax (e.g., CALL modelX!FORECAST(...)). While this output is visible in the Snowsight results pane, the CALL statement itself cannot be used directly as a subquery within a standard INSERT INTO or CREATE TABLE AS SELECT (CTAS) statement.
To persist the results of a model's prediction into a permanent table (tableX), the Data Analyst must utilize the RESULT_SCAN table function. Snowflake stores the results of every query and function call in a temporary cache for 24 hours. The RESULT_SCAN function allows you to treat that cache as a queryable table.
The standard workflow is:
Execute the forecast: CALL modelX!FORECAST(FORECASTING_PERIODS => 12);
Immediately after, use the LAST_QUERY_ID() function to identify the query that generated the forecast results.
Create the table by querying that result set: CREATE TABLE tableX AS SELECT * FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));
Evaluating the Options:
Option A is incorrect because the CALL syntax does not support a direct INTO clause for table creation.
Option B is incorrect because passing a table as an argument is part of the training or input phase, not the output persistence phase.
Option D is overly complex and contains non-standard terminology ("List the cache content").
Option C is the 100% correct answer. It reflects the required "post-processing" step in the Snowflake Data Cloud to bridge the gap between procedural model calls and relational table storage.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit