Creates a new machine learning model in the current/specified schema or replaces an existing model.
Note
Use the Snowflake Model Registry Python API to create models from scratch. In SQL, you can only create models from other models.
Models are versioned. All models must have at least one version, and one version must be designated as the default. To add a version to a model, use ALTER MODEL … ADD VERSION.
Some properties of a model can be modified (see ALTER MODEL), and multiple versions can be added.
This command also supports the following variant:
CREATE MODEL … FROM internalStage (creates a model from files in an external stage)
ALTER MODEL , ALTER MODEL … ADD VERSION , DROP MODEL , SHOW MODELS
CREATE [ OR REPLACE ] MODEL [ IF NOT EXISTS ] <name> [ WITH VERSION <version_name> ] FROM MODEL <source_model_name> [ VERSION <source_version_or_alias_name> ]
Copy
Variant Syntax¶This variant is used by the Snowflake Model Registry Python API. It is not possible to create models from scratch in SQL.
CREATE [ OR REPLACE ] MODEL [ IF NOT EXISTS ] <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.
Required parameters¶name
String that specifies the identifier (i.e. name) for the new model; must be unique for the schema in which the model is created.
In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"
). Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
FROM MODEL source_model_name
Specifies the name of the model from which to create the new model.
FROM internalStage
Specifies the internal stage that contains the model’s files. The required layout of these files is not currently documented.
WITH VERSION version_name
Specifies the name of the version to create in the new model.
VERSION source_version_or_alias_name
Specifies the name or alias of the version to be copied from the source model. If not specified, uses the default version from the source model.
A role used to execute this operation must have the following privileges at a minimum:
Privilege
Object
Notes
CREATE MODEL
Schema
Implied by OWNERSHIP on schema
OWNERSHIP
Model
A role must be granted or inherit the OWNERSHIP privilege on the object to create a temporary object that has the same name as the object that already exists in the schema.
The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶The OR REPLACE
and IF NOT EXISTS
clauses are mutually exclusive. They can’t both be used in the same statement.
CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4