SHOW LISTINGS

Lists the listings that you have privileges to access. Shows only listings where the user running the command has any of USAGE, MODIFY, or OWNERSHIP against the listing.

另请参阅:

CREATE LISTINGALTER LISTINGDESCRIBE LISTINGDROP LISTING

语法

SHOW LISTINGS [ LIKE '<pattern>' ]
              [ STARTS WITH '<name_string>' ]
              [ LIMIT <rows> [ FROM '<name_string>' ] ]
Copy

可选参数

LIKE 'pattern'

(可选)按对象名称筛选命令输出。筛选器使用 不区分大小写 的模式匹配,并支持 SQL 通配符(%_)。

例如,以下模式返回 相同的 结果:

... LIKE '%testing%' ...
... LIKE '%TESTING%' ...

. 默认:无值(不对输出应用筛选)。

STARTS WITH 'name_string'

(可选)根据对象名称开头显示的字符筛选命令输出。该字符串必须放在单引号内并且 区分大小写

例如,以下字符串会返回 不同的 结果:

... STARTS WITH 'B' ...
... STARTS WITH 'b' ...

. 默认:无值(不对输出应用筛选)

LIMIT rows [ FROM 'name_string' ]

(可选)限制返回的最大行数,同时还对结果启用“分页”功能。返回的实际行数可能小于指定的限制。例如,现有对象的数量小于指定的限制。

可选的 FROM 'name_string' 分子句实际上会充当结果的“游标”。这样就可以提取对象名称与指定字符串匹配的第一行之后的指定行数:

  • 该字符串必须放在单引号内并且 区分大小写

  • 该字符串不必包含完整的对象名称;支持部分名称。

默认:无值(不对输出应用限制)

备注

对于支持 FROM 'name_string'STARTS WITH 'name_string' 的 SHOW 子句,您可以将这两个子句组合在同一语句中。但是,两个条件都必须满足,否则它们相互抵消,不返回任何结果。

此外,对象按名称的字典顺序返回,因此 FROM 'name_string' 仅返回字典值高于 STARTS WITH 'name_string' 所返回行的行。

例如:

  • ... STARTS WITH 'A' LIMIT ... FROM 'B' 不会返回任何结果。

  • ... STARTS WITH 'B' LIMIT ... FROM 'A' 不会返回任何结果。

  • ... STARTS WITH 'A' LIMIT ... FROM 'AB' 将返回结果(如果有任何行与输入字符串匹配)。

使用说明

  • You can show a listing only if you use a role that has the USAGE, MODIFY, or OWNERSHIP privilege on the listing.

  • LIMIT rows 的值不能超过 10000。如果省略 LIMIT rows,若结果集大于 1 万行,则该命令将导致错误。

    要查看存在超过 1 万条记录的结果,请在 Snowflake Information Schema 中包含 LIMIT rows 或查询相应的视图。

  • To post-process the output of this command, you can use the pipe operator (->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.

    The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is type, then specify "type" for the identifier.

输出

命令输出在以下列中提供列表属性和元数据:

描述

global_name

列表的全局名称

name

创建列表时指定的名称。

title

列表清单中指定的标题

subtitle

列表清单中指定的子标题

profile

列表清单中指定的提供商简介名称。

created_on

列表的创建日期和时间。

updated_on

列表的上次更新日期和时间。

published_on

列表的上次发布日期和时间。

state

列表状态,以下之一:

  • DRAFT

  • PUBLISHED

  • UNPUBLISHED

review_state

审核状态,仅用于公开列表。

comment

关联的注释(如果存在)。

owner

列表所有者。

owner_role_type

所有者角色类型。

regions

列表区域。

target_accounts

目标账户的逗号分隔列表。

is_monetized

收费标志。

is_application

应用程序标志。如果为 true,则列表会被附加一个 Snowflake Native App。

is_targeted

针对性标志。

示例

显示名称以 MYLISTING 开头的所有列表:

SHOW LISTINGS LIKE 'MYLISTING%'
Copy

显示从列表 MYLISTING 开始的十个列表:

SHOW LISTINGS LIMIT 10 FROM 'MYLISTING%'
Copy
语言: 中文