ALTER MODEL¶

Modifies the properties for an existing model, including its name, tags, default version, or comment.

Three other variants of this command exist, namely:

Syntax¶

ALTER MODEL [ IF EXISTS ] <name> SET
  [ COMMENT = '<string_literal>' ]
  [ DEFAULT_VERSION = '<version_name>']

ALTER MODEL [ IF EXISTS ] <model_name> SET TAG <tag_name> = '<tag_value>'

ALTER MODEL [ IF EXISTS ] <model_name> UNSET TAG <tag_name> [ , <tag_name> ... ]

ALTER MODEL <model_name> RENAME TO <new_name>
Copy

Parameters¶

name

Specifies the identifier (i.e. name) of the model.

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

SET ...

Specifies one or more model properties to be set.

COMMENT = 'string_literal'

Sets the comment of the model. This can also be done using the COMMENT command.

DEFAULT_VERSION = 'version_name'

Sets the default version of the model (the version that methods are invoked on when calling a method directly on the model). The version name is an identifier.

TAG tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ]

Specifies the tag name and the tag string value.

The tag value is always a string, and the maximum number of characters for the tag value is 256.

For information about specifying tags in a statement, see Tag quotas for objects and columns.

UNSET TAG tag_name [ , tag_name ... ]

Specifies one or more tags to be unset on the model.

RENAME TO new_name

Renames the specified model with a new identifier that is not currently used by any other models in the schema.

For more details about identifiers, see Identifier requirements.

You can move the object to a different database and/or schema while optionally renaming the object. To do so, specify a qualified new_name value that includes the new database and/or schema name in the form db_name.schema_name.object_name or schema_name.object_name, respectively.

Note

  • The destination database and/or schema must already exist. In addition, an object with the same name cannot already exist in the new location; otherwise, the statement returns an error.

  • Moving an object to a managed access schema is prohibited unless the object owner (that is, the role that has the OWNERSHIP privilege on the object) also owns the target schema.

When an object (table, column, etc.) is renamed, other objects that reference it must be updated with the new name.

Access Control Requirements¶

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

Privilege

Object

Notes

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.