Describe tables

You use DESCRIBE or DESC command to view the description of a table.

(DESCRIBE | DESC) [AS JSON] TABLE table_name [ "(" field_name")"]

AS JSON can be specified if you want the output to be in JSON format. You could get information about a specific field in any table by providing the field name.

Example 1 - Describe a table

DESCRIBE TABLE stream_acct

Output:

=== Information ===
+-------------+-----+-------+----------------+----------+--------+----------+---------+---------+-------------+
|    name     | ttl | owner | jsonCollection | sysTable | parent | children | regions | indexes | description |
+-------------+-----+-------+----------------+----------+--------+----------+---------+---------+-------------+
| stream_acct |     |       | N              | N        |        |          |         |         |             |
+-------------+-----+-------+----------------+----------+--------+----------+---------+---------+-------------+

=== Fields ===
+----+----------------+--------------+----------+---------+----------+------------+----------+
| id |      name      |     type     | nullable | default | shardKey | primaryKey | identity |
+----+----------------+--------------+----------+---------+----------+------------+----------+
|  1 | acct_id        | Integer      | N        | NULL    | Y        | Y          |          |
+----+----------------+--------------+----------+---------+----------+------------+----------+
|  2 | profile_name   | String       | Y        | NULL    |          |            |          |
+----+----------------+--------------+----------+---------+----------+------------+----------+
|  3 | account_expiry | Timestamp(9) | Y        | NULL    |          |            |          |
+----+----------------+--------------+----------+---------+----------+------------+----------+
|  4 | acct_data      | Json         | Y        | NULL    |          |            |          |
+----+----------------+--------------+----------+---------+----------+------------+----------+
                                                                                                                                                          ---+----------+

Example 2 - Describe a table and display the output as JSON

DESC AS JSON TABLE BaggageInfo

Output:

{
  "json_version" : 2,
  "type" : "table",
  "name" : "BaggageInfo",
  "id" : "59",
  "fields" : [{
    "name" : "ticketNo",
    "type" : "LONG",
    "nullable" : false
  }, {
    "name" : "fullName",
    "type" : "STRING",
    "nullable" : true
  }, {
    "name" : "gender",
    "type" : "STRING",
    "nullable" : true
  }, {
    "name" : "contactPhone",
    "type" : "STRING",
    "nullable" : true
  }, {
    "name" : "confNo",
    "type" : "STRING",
    "nullable" : true
  }, {
    "name" : "bagInfo",
    "type" : "JSON",
    "nullable" : true
  }],
  "primaryKey" : ["ticketNo"],
  "shardKey" : ["ticketNo"]
}

Example 3 - Describe one particular field of a table

DESCRIBE TABLE BaggageInfo (ticketNo)

Output:

+----+----------+------+----------+---------+----------+------------+----------+
| id |   name   | type | nullable | default | shardKey | primaryKey | identity |
+----+----------+------+----------+---------+----------+------------+----------+
|  1 | ticketNo | Long | N        | NULL    | Y        | Y          |          |
+----+----------+------+----------+---------+----------+------------+----------+