DESCRIBE TABLE

적용 대상:검사 표시됨 예 Databricks SQL 검사 예 Databricks Runtime으로 표시됨

테이블의 기본 메타데이터 정보를 반환합니다. 메타데이터 정보에는 열 이름, 열 형식 및 열 주석이 포함됩니다. 필요에 따라 파티션 사양 또는 열 이름을 지정하여 파티션 또는 열과 관련된 메타데이터를 각각 반환할 수 있습니다. 델타 테이블을 사용하면 모든 필드가 반환되지는 않습니다.

구문

{ DESC | DESCRIBE } [ TABLE ] [ EXTENDED | FORMATTED ] table_name { [ PARTITION clause ] | [ column_name ] }

매개 변수

  • EXTENDED 또는 FORMATTED

    지정된 경우 명령에서 수집한 열 통계 및 추가 메타데이터 정보(예: 스키마 한정자, 소유자 및 액세스 시간)를 포함하여 지정된 열에 대한 자세한 정보가 표시됩니다.

  • Table_name

    설명할 테이블을 식별합니다. 이름은 임시 사양을 사용하지 않을 수 있습니다. 테이블을 찾을 수 없는 경우 Azure Databricks에서 TABLE_OR_VIEW_NOT_FOUND 오류가 발생합니다.

  • PARTITION 절

    명명된 파티션에 대한 추가 메타데이터를 반환하도록 Databricks SQL을 지시하는 선택적 매개 변수입니다.

  • column_name

    설명해야 하는 열 이름을 가진 선택적 매개 변수입니다. 현재 중첩된 열은 지정할 수 없습니다.

column_name 매개 변수 partition_spec 는 상호 배타적이며 함께 지정할 수 없습니다.

-- 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 Lake 테이블 세부 정보 검토를 참조하세요.