DESCRIBE SEMANTIC VIEW

返回语义视图的详细定义,包括逻辑表、外键关系、维度、指标、事实等元数据。

语法

{ DESCRIBE | DESC } SEMANTIC VIEW <name>;

其中

DESCRIBE
DESCRIBE
和
DESC
DESC
可互换使用。

参数说明

参数描述
<name>
<name>
语义视图的标识符。支持多段标识符(如
db.schema.view
db.schema.view
)。

输出列

DESC SEMANTIC VIEW 的输出以多行键值对形式呈现语义视图的完整结构。包含以下分类:

逻辑表(#logical tables)

每张逻辑表输出 2 行:

行列1列2列3
表头逻辑表别名关联物理表(
workspace.schema.table
workspace.schema.table
)
—
主键(空)主键列名主键列表

orders workspace.schema.orders primary key o_orderkey

外键关系(#relationships)

每条关系一行:

列1列2列3
(空)引用方表引用列 REFERENCE 被引用表(被引用列)

orders o_custkey REFERENCE customer(c_custkey)

事实(#facts)

列1列2列3
事实名称表达式(空)

customer.cust_order_count `count`(orders.o_orderkey)

维度(#dimensions)

列1列2列3
维度名称源列(空)

lineitem.l_returnflag lineitem.l_returnflag

指标(#metrics)

列1列2列3
指标名称聚合表达式(空)

lineitem.sum_qty `sum`(lineitem.l_quantity)

使用说明

  1. 无需运行中的虚拟集群 — 该命令不需要虚拟集群即可执行。
  2. 权限控制 — 仅返回当前用户有权限访问的语义视图定义。

权限要求

权限对象说明
任意权限语义视图至少需要对语义视图拥有一个权限

示例

查看语义视图结构

DESC SEMANTIC VIEW tpch_sv;

输出示例:

#logical tables orders tianqi_ws.public.orders primary key: o_orderkey customer tianqi_ws.public.customer primary key: c_custkey lineitem tianqi_ws.public.lineitem primary key: l_orderkey,l_linenumber ... #relationships orders(o_custkey) REFERENCE customer(c_custkey) lineitem(l_orderkey) REFERENCE orders(o_orderkey) lineitem(l_partkey) REFERENCE part(p_partkey) ... #facts customer.cust_order_count `count`(orders.o_orderkey) #dimensions lineitem.l_returnflag lineitem.l_returnflag lineitem.l_linestatus lineitem.l_linestatus lineitem.l_shipdate lineitem.l_shipdate ... #metrics lineitem.sum_qty `sum`(lineitem.l_quantity) lineitem.sum_base_price `sum`(lineitem.l_extendedprice) lineitem.avg_qty `avg`(lineitem.l_quantity) ...

输出 CREATE DDL

SHOW CREATE SEMANTIC VIEW tpch_sv;

相关命令

联系我们
预约咨询
微信咨询
电话咨询
邮件咨询