describe
describe | desc [as json]
{table table_name [field_name[,...] ] |
index index_name on table_name
}
表または索引に関する情報を記述します。オプションでJSON形式を使用できます。
完全修飾
table_name
を次のように指定します。
エントリ指定 | 説明 |
---|---|
table_name |
必須。表の完全な名前を指定します。それ以上の修飾子がない場合、このエントリはデフォルトのネームスペース(sysdefault)に作成された表を示します。このネームスペースを指定する必要はありません。 |
parent-table.child-table |
親の子表を指定します。親表、ピリオド(.)、子の名前の順に指定します。たとえば、親表がUsers の場合、MailingAddress という名前の子表はUsers.MailingAddress と指定します。
|
|
デフォルト以外のネームスペースに作成された表を指定します。ネームスペースの後にコロン(:)を付けて使用します。たとえば、Sales ネームスペースに作成されたUsers 表を参照するには、table_nameをSales:Users のように入力します。
|
次に、表
ns1:t1
に対するdescribe
の出力を示します。 sql-> describe table ns1:t1;
=== Information ===
+-----------+------+-----+-------+----------+----------+--------+----------+---------+-------------+
| namespace | name | ttl | owner | sysTable | r2compat | parent | children | indexes | description |
+-----------+------+-----+-------+----------+----------+--------+----------+---------+-------------+
| ns1 | t1 | | | N | N | | | | |
+-----------+------+-----+-------+----------+----------+--------+----------+---------+-------------+
=== Fields ===
+----+------+---------+----------+-----------+----------+------------+----------+
| id | name | type | nullable | default | shardKey | primaryKey | identity |
+----+------+---------+----------+-----------+----------+------------+----------+
| 1 | id | Integer | N | NullValue | Y | Y | |
+----+------+---------+----------+-----------+----------+------------+----------+
| 2 | name | String | Y | NullValue | | | |
+----+------+---------+----------+-----------+----------+------------+----------+
sql->
次の例では、同じ表に対して
describe as json
を使用しています。 sql-> describe as json table ns1:t1;
{
"json_version" : 1,
"type" : "table",
"name" : "t1",
"namespace" : "ns1",
"shardKey" : [ "id" ],
"primaryKey" : [ "id" ],
"fields" : [ {
"name" : "id",
"type" : "INTEGER",
"nullable" : false,
"default" : null
}, {
"name" : "name",
"type" : "STRING",
"nullable" : true,
"default" : null
} ]
}