snowflake.snowpark.functions.model¶

snowflake.snowpark.functions.model(model_name: str, version_or_alias_name: Optional[str] = None) → Callable[source]¶

Creates a model function that can be used to call a model method.

Parameters:
  • model_name – The name of the model to call.

  • version_or_alias_name – The version or alias name of the model to call.

Example:

>>> df = session.table("TESTSCHEMA_SNOWPARK_PYTHON.DIAMONDS_TEST")
>>> model_fn = model("TESTSCHEMA_SNOWPARK_PYTHON.DIAMONDS_PRICE_PREDICTION", "v1")
>>> result_df = df.select(model_fn(
...     "predict",
...     col("CUT_OE"), col("COLOR_OE"), col("CLARITY_OE"), col("CARAT"),
...     col("DEPTH"), col("TABLE_PCT"), col("X"), col("Y"), col("Z")
... )["output_feature_0"])
>>> result_df.count()
5412


This function or method is experimental since 1.34.0.
Copy