Delen via


SHOW PARTITIONS

Van toepassing op: vinkje als ja aan Databricks SQL vinkje als ja aan Databricks Runtime

Hiermee worden partities van een tabel weergegeven.

Syntaxis

SHOW PARTITIONS table_name [ PARTITION clause ]

Parameters

  • table_name

    Identificeert de tabel. De naam mag geen tijdelijke specificatie bevatten.

  • PARTITION-component

    Een optionele parameter waarmee een partitie wordt opgegeven. Als de specificatie slechts een gedeeltelijke overeenkomende partitie is, worden geretourneerd. Als er geen partitie is opgegeven in databricks SQL, worden alle partities geretourneerd.

Voorbeelden

-- create a partitioned table and insert a few rows.
> USE salesdb;
> CREATE TABLE customer(id INT, name STRING) PARTITIONED BY (state STRING, city STRING);
> INSERT INTO customer PARTITION (state = 'CA', city = 'Fremont') VALUES (100, 'John');
> INSERT INTO customer PARTITION (state = 'CA', city = 'San Jose') VALUES (200, 'Marry');
> INSERT INTO customer PARTITION (state = 'AZ', city = 'Peoria') VALUES (300, 'Daniel');

-- Lists all partitions for table `customer`
> SHOW PARTITIONS customer;
   state=AZ/city=Peoria
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Lists all partitions for the qualified table `customer`
> SHOW PARTITIONS salesdb.customer;
   state=AZ/city=Peoria
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Specify a full partition spec to list specific partition
> SHOW PARTITIONS customer PARTITION (state = 'CA', city = 'Fremont');
 |state=CA/city=Fremont|

-- Specify a partial partition spec to list the specific partitions
> SHOW PARTITIONS customer PARTITION (state = 'CA');
  state=CA/city=Fremont
 state=CA/city=San Jose

-- Specify a partial spec to list specific partition
> SHOW PARTITIONS customer PARTITION (city =  'San Jose');
 state=CA/city=San Jose