وصف الجدول
ينطبق على: التحقق من Databricks SQL
Databricks Runtime
إرجاع معلومات بيانات التعريف الأساسية لجدول. تتضمن معلومات بيانات التعريف اسم العمود ونوع العمود وتعليق العمود. اختياريا، يمكنك تحديد مواصفات القسم أو اسم العمود لإرجاع بيانات التعريف المتعلقة بقسم أو عمود على التوالي. باستخدام جداول Delta، لا يتم إرجاع كافة الحقول.
بناء الجمله
{ DESC | DESCRIBE } [ TABLE ] [ EXTENDED | FORMATTED ] table_name { [ PARTITION clause ] | [ column_name ] }
معلمات
EXTENDED
اوFORMATTED
إذا تم تحديد عرض معلومات مفصلة حول الأعمدة المحددة، بما في ذلك إحصائيات العمود التي تم جمعها بواسطة الأمر، ومعلومات إضافية عن بيانات التعريف (مثل مؤهل المخطط والمالك ووقت الوصول).
-
يحدد الجدول المراد وصفه. قد لا يستخدم الاسم مواصفات زمنية. إذا تعذر العثور على الجدول، فإن Azure Databricks يثير خطأ TABLE_OR_VIEW_NOT_FOUND .
-
معلمة اختيارية توجه Databricks SQL لإرجاع بيانات تعريف الإضافة للأقسام المسماة.
-
معلمة اختيارية مع اسم العمود الذي يجب وصفه. لا يسمح حاليا بتحديد الأعمدة المتداخلة.
المعلمات partition_spec
و column_name
هي حصرية بشكل متبادل ولا يمكن تحديدها معا.
امثله
-- Creates a table `customer`. Assumes current schema is `salesdb`.
> CREATE TABLE customer(
cust_id INT,
state VARCHAR(20),
name STRING COMMENT 'Short name'
)
USING parquet
PARTITIONED BY (state);
> INSERT INTO customer PARTITION (state = 'AR') VALUES (100, 'Mike');
-- Returns basic metadata information for unqualified table `customer`
> DESCRIBE TABLE customer;
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
-- Returns basic metadata information for qualified table `customer`
> DESCRIBE TABLE salesdb.customer;
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
-- Returns additional metadata such as parent schema, owner, access time etc.
> DESCRIBE TABLE EXTENDED customer;
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 Table Information
Database default
Table customer
Owner <TABLE OWNER>
Created Time Tue Apr 07 22:56:34 JST 2020
Last Access UNKNOWN
Created By <SPARK VERSION>
Type MANAGED
Provider parquet
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...
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
وصف التفاصيل
DESCRIBE DETAIL [schema_name.]table_name
DESCRIBE DETAIL delta.`<path-to-table>`
إرجاع معلومات حول المخطط والتقسيم وحجم الجدول وما إلى ذلك. على سبيل المثال، بالنسبة لجداول Delta، يمكنك مشاهدة إصدارات القارئ والكاتب الحالية لجدول. راجع مراجعة تفاصيل جدول Delta Lake مع وصف تفاصيل مخطط التفاصيل.