QuestionQ19

Implement Snowflake data science best practices

A Data Scientist at a telecommunications company needs to store churn scores calculated by a Snowflake external function that is configured to connect to a model endpoint.

The environment conditions are:

The External Function DDL:

Question Image

The CUSTOMER_DAILY table:

Question Image

The churn value is stored in a new table named CUSTOMER_CHURN:

Question Image

Based on these environmental conditions, how can the Data Scientist persistently store the churn scores from the external function in Showflake?

  • A insert into customer_churnselectcust_id,get_churn(*) as churn_scorefromcustomer_daily;
  • B insert into customer_churnselectcust_id,call get_churn(object_construct(*)) as churn_scorefromcustomer_daily;
  • C insert into customer_churnselectcust_id,call get_churn(*) as churn_scorefromcustomer_daily;
  • D insert into customer_churnselectcust_id,get_churn(object_construct(*)) as churn_scorefromcustomer_daily;
Explanation

get_churn requires a single VARIANT input, and OBJECT_CONSTRUCT(*) creates an object from all columns in each source row that can be supplied as that argument. An external function is invoked in a SELECT expression like a UDF, so its numeric result can be selected with cust_id and inserted into CUSTOMER_CHURN; CALL is not the scalar-function invocation syntax.

Learn more

Community Discussion

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