ALTER SEMANTIC VIEW

Modifies the comment for an existing semantic view or renames a semantic view.

备注

You can't use the ALTER SEMANTIC VIEW command to change properties other than the comment. To change other properties of the semantic view, replace the semantic view. See 替换现有的语义视图.

另请参阅:

CREATE SEMANTIC VIEW , DESCRIBE SEMANTIC VIEW , DROP SEMANTIC VIEW , SHOW SEMANTIC VIEWS , SHOW SEMANTIC DIMENSIONS , SHOW SEMANTIC DIMENSIONS FOR METRIC , SHOW SEMANTIC FACTS , SHOW SEMANTIC METRICS

语法

ALTER SEMANTIC VIEW [ IF EXISTS ] <name> RENAME TO <new_name>

ALTER SEMANTIC VIEW [ IF EXISTS ] <name> SET
  COMMENT = '<string_literal>'

ALTER SEMANTIC VIEW [ IF EXISTS ] <name> UNSET
  COMMENT
Copy

参数

name

Specifies the identifier for the semantic view to alter.

如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。

有关更多信息,请参阅 标识符要求

RENAME TO new_name

Changes the name of the semantic view to new_name. The new identifier must be unique within the schema.

有关标识符的更多详细信息,请参阅 标识符要求

可以将对象移动到其他数据库和/或架构,同时选择重命名对象。为此,请指定一个限定 new_name 值,该值分别以 db_name.schema_name.object_nameschema_name.object_name 的形式包含新数据库和/或架构名称。

备注

  • 目标数据库和/或架构必须已存在。此外,新位置中不能存在同名对象;否则,该语句将返回错误。

  • 除非 对象所有者(即拥有对象 OWNERSHIP 权限的角色)也拥有目标架构,否则禁止将对象移动到托管访问架构。

重命名对象时,引用该对象的其他对象必须使用新名称进行更新。

SET ...

Sets one or more specified properties or parameters for the semantic view:

COMMENT = 'string_literal'

Adds a comment or overwrites an existing comment for the semantic view.

UNSET ...

Unsets one or more specified properties or parameters for the semantic view, which resets the properties to their defaults:

  • COMMENT

要使用单个 ALTER 语句取消设置多个属性或参数,请使用逗号分隔每个属性或参数。

取消设置属性或参数时,只指定属性或参数名称(除非上述语法表明您应该指定值)。指定值会返回错误。

访问控制要求

用于执行此操作的 角色 必须至少具有以下 权限

权限

对象

备注

OWNERSHIP

语义视图

OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege).

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.

有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色

有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

使用说明

  • 关于元数据:

    注意

    客户应确保在使用 Snowflake 服务时,不会将个人数据(用户对象除外)、敏感数据、出口管制数据或其他受监管数据作为元数据输入。有关更多信息,请参阅 Snowflake 中的元数据字段

示例

The following example renames a semantic view:

ALTER SEMANTIC VIEW sv RENAME TO sv_new_name;
Copy

The following example sets the comment for a semantic view:

ALTER SEMANTIC VIEW my_semantic_view SET COMMENT = 'my comment';
Copy

The following example unsets the existing comment for a semantic view:

ALTER SEMANTIC VIEW my_semantic_view UNSET COMMENT;
Copy
语言: 中文