ALTER MODEL … ADD VERSION

Adds a new version to an existing model from an internal stage. Versions are the actual model code that contains methods that can be called to perform inference and other functions.

Note

Use the Snowflake Model Registry Python API to create model versions from scratch. In SQL, you can only create model versions from existing model versions.

Some version properties can be modified (see ALTER MODEL … MODIFY VERSION), but the actual model implementation contained in a version is immutable.

This command also supports the following variant:

  • ALTER MODEL .. ADD VERSION … FROM MODEL (creates a model version from a version of an existing model)

See also:

ALTER MODEL … MODIFY VERSION, ALTER MODEL … DROP VERSION

Syntax

ALTER MODEL [ IF EXISTS ] <name> ADD VERSION <version_name> FROM internalStage
Copy

Where:

internalStage ::=
    @[<namespace>.]<int_stage_name>[/<path>]
| @[<namespace>.]%<table_name>[/<path>]
| @~[/<path>]
Copy

For additional internal stage details, see Choosing an internal stage for local files.

Variant Syntax

ALTER MODEL [ IF EXISTS ] <name> ADD VERSION <version_name>
  FROM MODEL <source_model_name> [ VERSION <source_version_name> ]
Copy

Parameters

name

Specifies the identifier of the model. If the identifier contains spaces, special characters, or mixed-case characters, the entire identifier must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. For information on identifier syntax, see Identifier requirements.

version_name

Specifies the identifier of the version, which must be unique within the model. If the identifier contains spaces, special characters, or mixed-case characters, the entire identifier must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. For information on identifier syntax, see Identifier requirements.

internalStage
Required if not using FROM MODEL variant

Specifies the internal stage that contains the version’s files. The required layout of these files is not currently documented.

source_model_name
Required if using FROM MODEL variant

Specifies the name of the model from which the new version will be obtained.

source_version_name
For use with FROM MODEL variant

Specifies the name of the version to be copied from the source model. If not specified, uses the default version from the source model.