QuestionQ11

VerifiedTrain and use machine learning models

A Data Scientist has trained a model that is stored as a file on a Snowflake stage. They now want to score data in Snowflake using the model through a Python User-Defined Function (UDF).

One requirement is that they must be able to replace the model file with a newer one without needing to recreate the UDF.

What is required to accomplish this?

Explanation

A Python UDF can dynamically load a model directly from its staged path at execution time by using SnowflakeFile. Replacing the file at that same stage path lets subsequent executions use the new model without recreating the UDF. In contrast, a file listed in IMPORTS is copied into the UDF’s import directory during UDF creation, so it does not automatically reflect a later replacement of the staged file.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!