DESCRIBE RESULT¶
描述查询结果中的列。
Snowflake 将查询结果保留一段时间,之后将清除查询结果。查询可以来自当前会话或任何其他会话,包括过去的会话,只要未超过有限期限即可。此期限不可调整。有关更多详细信息,请参阅 使用持久化查询结果。
DESCRIBE 可以缩写为 DESC。
- 另请参阅:
LAST_QUERY_ID (上下文函数)、RESULT_SCAN (表函数)
语法¶
参数¶
query_id或LAST_QUERY_ID()指定(过去 24 小时内在任意会话中)您执行的查询的 ID,或者 LAST_QUERY_ID 函数,该函数返回当前会话中的查询的 ID。
使用说明¶
要检索特定查询的 ID,请执行以下操作:
在 Web 界面中找到该查询 ID。History
页面列出了 ID 以及每个查询;但是,请注意,您只能对已执行的查询使用此函数。
执行 QUERY_HISTORY、QUERY_HISTORY_BY_* 表函数,该函数返回查询及其 IDs 的列表;但是,请注意,您只能对已执行的查询使用此函数。
如果查询是在当前会话中执行的,请执行 LAST_QUERY_ID 函数。例如:
请注意,这等同于将 LAST_QUERY_ID() 用作 DESC RESULT 的输入。
要对该命令的输出进行后处理,可以使用 管道运算符 或 RESULT_SCAN 函数。两种结构都将输出视为可以查询的结果集。
For example, you can use the pipe operator or RESULT_SCAN function to select specific columns from the SHOW command output or filter the rows.
When you refer to the output columns, use double-quoted identifiers for the column names. For example, to select the output column
type, specifySELECT "type".You must use double-quoted identifiers because the output column names for SHOW commands are in lowercase. The double quotes ensure that the column names in the SELECT list or WHERE clause match the column names in the SHOW command output that was scanned.
示例¶
描述来自任何会话(过去 24 小时内)的指定查询结果中的列:
描述当前会话中最新查询的结果中的列: