SHOW TBLPROPERTIES

Si applica a:check contrassegnato sì controllo SQL databricks contrassegnato come sì Databricks Runtime

Restituisce il valore di una proprietà di tabella in base a un valore facoltativo per una chiave di proprietà. Se non viene specificata alcuna chiave, vengono restituite tutte le proprietà e le opzioni. Le opzioni della tabella sono precedute da option.

Sintassi

SHOW TBLPROPERTIES table_name
   [ ( [unquoted_property_key | property_key_as_string_literal] ) ]

unquoted_property_key
  key_part1 [. ...]

Parametri

  • Table_name

    Identifica la tabella. Il nome non deve includere una specifica temporale.

  • unquoted_property_key

    Chiave della proprietà in formato senza virgole. La chiave può essere costituita da più parti separate da un punto.

  • property_key_as_string_literal

    Valore della chiave di proprietà come valore letterale stringa.

Nota

Il valore della proprietà restituito da questa istruzione esclude alcune proprietà interne a spark e hive. Le proprietà escluse sono:

  • Tutte le proprietà che iniziano con il prefisso spark.sql
  • Chiavi di proprietà, ad esempio: EXTERNAL, comment
  • Tutte le proprietà generate internamente da hive per archiviare le statistiche. Alcune di queste proprietà sono: numFiles, , numPartitionsnumRows.

Esempi

-- create a table `customer` in schema `salessc`
> USE salessc;
> CREATE TABLE customer(cust_code INT, name VARCHAR(100), cust_addr STRING)
    TBLPROPERTIES ('created.by.user' = 'John', 'created.date' = '01-01-2001');

-- show all the user specified properties for table `customer`
> SHOW TBLPROPERTIES customer;
                   key      value
 --------------------- ----------
       created.by.user       John
          created.date 01-01-2001
 transient_lastDdlTime 1567554931

-- show all the user specified properties for a qualified table `customer`
-- in schema `salessc`
> SHOW TBLPROPERTIES salessc.customer;
                   key      value
 --------------------- ----------
       created.by.user       John
          created.date 01-01-2001
 transient_lastDdlTime 1567554931

-- show value for unquoted property key `created.by.user`
> SHOW TBLPROPERTIES customer (created.by.user);
 value
 -----
  John

-- show value for property `created.date`` specified as string literal
> SHOW TBLPROPERTIES customer ('created.date');
      value
 ----------
 01-01-2001