ALTER LISTING

Modifies the properties of a listings with an inline YAML manifest, or from a file located in a stage location.

备注

We recommend running DESCRIBE LISTING to view the current properties of a listing before running ALTER LISTING.

另请参阅:

CREATE LISTINGDESCRIBE LISTINGSHOW LISTINGSSHOW VERSIONS IN LISTINGDROP LISTING

语法

ALTER LISTING [ IF EXISTS ] <name> [ { PUBLISH | UNPUBLISH | REVIEW } ]

ALTER LISTING [ IF EXISTS ] <name> AS '<yaml_manifest_string>'
  [ PUBLISH = { TRUE | FALSE } ]
  [ REVIEW = { TRUE | FALSE } ]
  [ COMMENT = '<string>' ]

ALTER LISTING <name> ADD VERSION [ [ IF NOT EXISTS ] <version_name> ]
  FROM <yaml_manifest_stage_location>
  [ COMMENT = '<string>' ]

ALTER LISTING [ IF EXISTS ] <name> { ADD | REMOVE } TARGETS <manifest>

ALTER LISTING [ IF EXISTS ] <name> RENAME TO <new_name>;

ALTER LISTING [ IF EXISTS ] <name> SET COMMENT = '<string>'
Copy

参数

name

指定要更改的列表的标识符(名称)。

{ PUBLISH | UNPUBLISH | REVIEW }

要对列表执行的操作:

  • PUBLISH 使以前不可发现的列表变得可发现。

    在以前发布的列表上指定 PUBLISH 不会起作用。

  • UNPUBLISH 使以前可发现的列表对新使用者而言不可发现。现有使用者可以继续访问与未发布的列表关联的数据。

    在以前未发布的列表上指定 UNPUBLISH 不会起作用。

See also 取消发布列表.

  • REVIEW 提交列表以供审核。

yaml_manifest_string

列表的 YAML 清单。有关清单参数,请参阅 列表清单引用

清单通常用以美元为引号的字符串形式提供。有关更多信息,请参阅 以美元为引号的字符串常量

ADD VERSION version_name

指定所添加版本的唯一版本标识符。如果标识符包含空格、特殊字符或大小写混合字符,则整个标识符必须放在双引号内。放在双引号内的标识符也区分大小写。有关标识符语法的信息,请参阅 标识符要求

FROM 'yaml_manifest_stage_location'

指定内部或 Snowflake Git 存储库克隆 manifest.yml 文件的路径。如果此变更需要 Marketplace Ops 审查,请使用 REVIEW 和 PUBLISH 操作。

{ ADD | REMOVE } TARGETS manifest

Add targets to or remove targets from a listing using the manifest containing only the targets you want to add or remove. This partial manifest reuses the familiar structures targets, external_targets, and organization_targets, which are already defined in the listing manifest specification.

The table below lists unsupported listing-manifest / incoming-manifest combinations:

备注

V2 listings are still in preview. Upon feature enablement, all subsequent listings, whether public or private, will be created as v2 listings.

External listing targets version

Incoming manifest

结果

Workaround

V1 targets

V2 external targets

Returns an error.

Provide a version 1 incoming manifest.

V2 targets

V1 targets

Returns an error.

Provide a version 2 incoming manifest.

Any external listing

Organization-level target that specifies an organization without accounts.

Returns an error.

Organization-level targets aren't supported at this time.

For organizational listings, the table below lists unsupported use cases for adding and removing targets:

External listing

Incoming manifest

Add or remove

结果

操作

Any organization listing

Manifest has the organization_user_group field set.

两者

Returns an error.

Remove the organization_user_group field and try again.

Account or account and role

Manifest has the all_internal_accounts field set to TRUE.

Remove

Returns an error.

Remove specific accounts and try again.

The listing has the all_internal_accounts field set to TRUE.

The incoming manifest includes an account or an account and role.

Remove

Returns an errors.

Replace all_internal_accounts with specific accounts and try again.

Account has no roles specified

Incoming manifest has an account with roles.

Remove

Returns an error.

Remove the account first and then add specific roles.

RENAME TO new_name

将列表名称更改为 new_name。列表名称必须是唯一的。如果新标识符已用于其他列表,则不能使用该标识符。

SET ...

指定要为列表设置的一个(或多个)属性(用空格、逗号或换行符分隔)。

COMMENT = 'string_literal'

为现有列表添加注释或覆盖现有注释。

PUBLISH = { TRUE | FALSE }

指定应如何发布列表。

如果为 TRUE,列表会立即发布到 Marketplace Ops 以供审核。

默认:TRUE。

REVIEW =  { TRUE | FALSE }

指定列表是否应提交到 Marketplace Ops 进行审核。

默认:TRUE。

PUBLISH 和 REVIEW 属性的不同值组合会导致以下行为:

PUBLISH

REVIEW

行为

TRUE

TRUE

请求审核,在获得批准后立即发布。

TRUE

FALSE

导致错误。您不能未经审核便在 Snowflake Marketplace 上发布列表。

FALSE

TRUE

请求审核,但审核后不会自动发布。

FALSE

FALSE

不请求审核或发布,将列表另存为草稿。

使用说明

  • 列表只能在 DRAFT 状态下重命名。

  • 在为列表设置 YAML 格式清单的实时版本时,您必须使用 COMMIT 以应用更改,或使用 ABORT 以放弃更改。

访问控制要求

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

权限

对象

备注

OWNERSHIP 或 MODIFY

要修改的列表。

如果您使用 ALTER 命令来修改自动履行的清单内容,则必须使用具有必要的委托权限的角色来配置 Cross-Cloud Auto-Fulfillment。请参阅 委派自动履行的设置权限

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 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

示例

Alters the listing mylisting to use an updated manifest file:

ALTER LISTING mylisting
AS
$$
title: "MyListing"
subtitle: "Subtitle for MyListing"
description: "Description or MyListing"
listing_terms:
  type: "STANDARD"
targets:
  accounts: ["Org1.Account1"]
usage_examples:
  - title: "this is a test sql"
    description: "Simple example"
    query: "select *"
$$;
Copy

Submits the mylisting listing for review:

ALTER LISTING mylisting REVIEW;
Copy

Alters the mylisting listing by publishing it:

ALTER LISTING mylisting PUBLISH;
Copy

Alters the mylisting listing by unpublishing it:

ALTER LISTING mylisting UNPUBLISH;
Copy

Alters the mylisting listing by setting a new comment:

ALTER LISTING mylisting SET COMMENT = 'My listing is ready!';
Copy

从指定的 YAML 清单文件暂存区位置添加新版本:

ALTER LISTING mylisting ADD VERSION V3 FROM @dbforstage.public.listingstage/listingmanifests;
Copy

Alters a listing so that targets will take the incoming manifest and merge it with the existing listing targets:

ALTER LISTING mylisting ADD TARGETS $$manifest$$;
Copy

Adds targets to an external V1 listing:

ALTER LISTING mylisting ADD TARGETS
$$
targets:
  accounts: ["Org1.Account1", "Org2.Account2"]
$$;
Copy

Adds targets to an external V2 listing:

ALTER LISTING mylisting ADD TARGETS
$$
external_targets:
  access:
    - organization: OrgName2
      accounts: [acc1, acc2]
$$;
Copy

When adding targets, this takes the incoming manifest and merges it with the existing organization_targets.

ALTER LISTING mylisting ADD TARGETS
$$
organization_targets:
  access:
    - account: account2
      roles: [role1, role2]
$$;
Copy

Removes a target:

ALTER LISTING mylisting REMOVE TARGETS $$manifest$$;
Copy

Removes targets from an external V1 listing:

ALTER LISTING mylisting REMOVE TARGETS
$$
targets:
  accounts: ["Org1.Account1", "Org2.Account2"]
$$;
Copy

Removes targets from an external V2 listing:

ALTER LISTING mylisting REMOVE TARGETS
$$
external_targets:
  access:
    - organization: OrgName2
      accounts: [acc1, acc2]
$$;
Copy

Removes targets from an organizational listing:

ALTER LISTING mylisting REMOVE TARGETS
$$
organization_targets:
  access:
    - account: account1
$$;
Copy
语言: 中文