snowflake.ml.model.Model

class snowflake.ml.model.Model

Bases: object

Model Object containing multiple versions. Maps to SQL’s MODEL object.

Methods

delete_version(version_name: str) None

Drop a version of the model.

Parameters:

version_name – The name of the version.

get_tag(tag_name: str) Optional[str]

Get the value of a tag attached to the model.

Parameters:

tag_name – The name of the tag. Can be fully qualified. If not fully qualified, the database or schema of the model will be used.

Returns:

The tag value as a string if the tag is attached, otherwise None.

rename(model_name: str) None

Rename a model. Can be used to move a model when a fully qualified name is provided.

Parameters:

model_name – The new model name.

set_tag(tag_name: str, tag_value: str) None

Set the value of a tag, attaching it to the model if not.

Parameters:
  • tag_name – The name of the tag, can be fully qualified. If not fully qualified, the database or schema of the model will be used.

  • tag_value – The value of the tag

show_tags() Dict[str, str]

Get a dictionary showing the tag and its value attached to the model.

Returns:

The model version object.

show_versions() DataFrame

Show information about all versions in the model.

Returns:

A Pandas DataFrame showing information about all versions in the model.

unset_tag(tag_name: str) None

Unset a tag attached to a model.

Parameters:

tag_name – The name of the tag, can be fully qualified. If not fully qualified, the database or schema of the model will be used.

version(version_name: str) ModelVersion

Get a model version object given a version name in the model.

Parameters:

version_name – The name of the version.

Raises:

ValueError – When the requested version does not exist.

Returns:

The model version object.

versions() List[ModelVersion]

Get all versions in the model.

Returns:

A list of ModelVersion objects representing all versions in the model.

Attributes

comment

The comment to the model.

default

The default version of the model.

description

The description for the model. This is an alias of comment.

fully_qualified_name

Return the fully qualified name of the model that can be used to refer to it in SQL.

name

Return the name of the model that can be used to refer to it in SQL.