描述表
返回表的基本元數據信息。元數據信息包括列名、列類型和列注釋。您可以指定分區規範或列名,以分別返回與分區或列相關的元數據。
參數
擴展
或格式化
如果指定,則顯示指定列的詳細信息,包括命令收集的列統計信息,以及附加的元數據信息(例如模式限定符、所有者和訪問時間)。
標識要描述的表。名稱不能使用時間規範.
一個可選參數,指示Databricks Runtime返回指定分區的添加元數據。
帶有需要描述的列名的可選參數。目前不允許指定嵌套列。
參數partition_spec
而且column_name
是互斥的,不能一起指定。
例子
—創建表“customer”。假設當前模式為' salesdb '。CREATE TABLE customer(cust_id INT, state VARCHAR(20), name STRING COMMENT '短名')USING parquet PARTITIONED BY (state);> INSERT INTO customer PARTITION (state = 'AR') VALUES (100, 'Mike');——返回不合格表' customer ' >的基本元數據信息;col_name data_type comment ----------------------- ------------------- cust_id int null name string短名稱state string null #分區信息# col_name data_type comment state string null——返回合格表' customer '的基本元數據信息> description table salesdb.customer;col_name data_type comment ----------------------- ------------------- cust_id int null name string短名稱state string null #分區信息# col_name data_type comment state string null——返回額外的元數據,如父模式、所有者、訪問時間等。col_name data_type comment ---------------------------- ------------------------------ ---------- cust_id int null name string短名state string null #分區信息# col_name data_type comment state string null #詳細表信息數據庫default表customer Owner < Table Owner > Created Time Tue Apr 07 22:56:34 JST 2020 Last Access UNKNOWN Created By Type MANAGED Provider parquet Location file:/tmp/salesdb.db/custom…Serde圖書館org.apache.hadoop.hive.ql.i……InputFormat org.apache.hadoop.hive.ql.i…… OutputFormat org.apache.hadoop.hive.ql.i... Partition Provider Catalog -- Returns partition metadata such as partitioning column name, column type and comment. > DESCRIBE TABLE EXTENDED customer PARTITION (state = 'AR'); col_name data_type comment ------------------------------ ------------------------------ ---------- cust_id int null name string Short name state string null # Partition Information # col_name data_type comment state string null # Detailed Partition Inform... Database default Table customer Partition Values [state=AR] Location file:/tmp/salesdb.db/custom... Serde Library org.apache.hadoop.hive.ql.i... InputFormat org.apache.hadoop.hive.ql.i... OutputFormat org.apache.hadoop.hive.ql.i... Storage Properties [serialization.format=1, pa... Partition Parameters {transient_lastDdlTime=1586... Created Time Tue Apr 07 23:05:43 JST 2020 Last Access UNKNOWN Partition Statistics 659 bytes # Storage Information Location file:/tmp/salesdb.db/custom... Serde Library org.apache.hadoop.hive.ql.i... InputFormat org.apache.hadoop.hive.ql.i... OutputFormat org.apache.hadoop.hive.ql.i... -- Returns the metadata for `name` column. -- Optional `TABLE` clause is omitted and column is fully qualified. > DESCRIBE customer salesdb.customer.name; info_name info_value --------- ---------- col_name name data_type string comment Short name > CREATE TABLE T(pk1 INTEGER NOT NULL, pk2 INTEGER NOT NULL, CONSTRAINT t_pk PRIMARY KEY(pk1, pk2)); > CREATE TABLE S(pk INTEGER NOT NULL PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, CONSTRAINT s_t_fk FOREIGN KEY(fk1, fk2) REFERENCES T); > DESCRIBE TABLE EXTENDED T; col_name data_type comment --------------------- ---------------------------- ---------- pk1 int pk2 int # Detailed Table I... Database default Table t Owner ... Created Time Mon Nov 15 11:42:07 PST 2021 ... Partition Provider Catalog # Constraints t_pk PRIMARY KEY (pk1, pk2) > DESCRIBE TABLE EXTENDED S; col_name data_type comment --------------------- ----------------------------------------------------- ---------- pk int fk1 int fk2 int # Detailed Table Inf... Database default Table s Owner ... Created Time Mon Nov 15 11:42:35 PST 2021 ... Partition Provider Catalog # Constraints s_pk PRIMARY KEY (pk) s_fk_p FOREIGN KEY (fk1, fk2) REFERENCES default.t (pk1, pk2)
描述的細節
[schema_name描述細節。]table_name描述的細節delta.``
返回關於模式、分區、表大小等的信息。例如,對於Delta表,您可以看到當前的Reader和writer版本的一個表。看到詳細模式對於詳細模式。