表の説明
DESCRIBEまたはDESCコマンドを使用して、表の説明を表示します。
(DESCRIBE | DESC) [AS JSON] TABLE table_name [ "(" field_name")"]
出力をJSON形式にする場合、AS JSONを指定できます。フィールド名を指定して、任意の表の特定のフィールドに関する情報を取得できます。
例1: 表の説明
DESCRIBE TABLE stream_acct
出力:
=== 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 | | | |
+----+----------------+--------------+----------+---------+----------+------------+----------+
---+----------+
例2: 表の説明およびJSONとしての出力の表示
DESC AS JSON TABLE BaggageInfo
出力:
{
"json_version" : 1,
"type" : "table",
"name" : "BaggageInfo",
"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"]
}
例3: 表のある特定のフィールドの説明
DESCRIBE TABLE BaggageInfo (ticketNo)
出力:
+----+----------+------+----------+---------+----------+------------+----------+
| id | name | type | nullable | default | shardKey | primaryKey | identity |
+----+----------+------+----------+---------+----------+------------+----------+
| 1 | ticketNo | Long | N | NULL | Y | Y | |
+----+----------+------+----------+---------+----------+------------+----------+