CREATE MODEL¶

Creates a new machine learning model in the current/specified schema or replaces an existing model.

Note

This command exists for use by the Snowpark Model Registry Python API. Use that API to create models. You cannot currently create models using SQL.

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 any number of versions can be added.

See also:

ALTER MODEL, ALTER MODEL … ADD VERSION, DROP MODEL , SHOW MODELS

Syntax¶

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.

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.

internalStage

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

Access Control Requirements¶

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

CREATE MODEL

Schema

Implied by USAGE 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.

Note that operating on any object in a schema also requires the USAGE privilege on the parent database and 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.