| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. groonga-command |
| 4 |
.. database: commands_column_list |
| 5 |
|
| 6 |
``column_list`` |
| 7 |
=============== |
| 8 |
|
| 9 |
Summary |
| 10 |
------- |
| 11 |
|
| 12 |
``column_list`` command lists columns in a table. |
| 13 |
|
| 14 |
Syntax |
| 15 |
------ |
| 16 |
|
| 17 |
This command takes only one required parameter:: |
| 18 |
|
| 19 |
column_list table |
| 20 |
|
| 21 |
Usage |
| 22 |
----- |
| 23 |
|
| 24 |
Here is a simple example of ``column_list`` command. |
| 25 |
|
| 26 |
.. groonga-command |
| 27 |
.. include:: ../../example/reference/commands/column_list/column_list.log |
| 28 |
.. table_create Users TABLE_PAT_KEY ShortText |
| 29 |
.. column_create Users age COLUMN_SCALAR UInt8 |
| 30 |
.. column_create Users tags COLUMN_VECTOR ShortText |
| 31 |
.. column_list Users |
| 32 |
|
| 33 |
|
| 34 |
Parameters |
| 35 |
---------- |
| 36 |
|
| 37 |
This section describes parameters of ``column_list``. |
| 38 |
|
| 39 |
Required parameters |
| 40 |
^^^^^^^^^^^^^^^^^^^ |
| 41 |
|
| 42 |
All parameters are required. |
| 43 |
|
| 44 |
``table`` |
| 45 |
""""""""" |
| 46 |
|
| 47 |
Specifies the name of table to be listed columns. |
| 48 |
|
| 49 |
Return value |
| 50 |
------------ |
| 51 |
|
| 52 |
``column_list`` returns the list of column information in the table:: |
| 53 |
|
| 54 |
[ |
| 55 |
HEADER, |
| 56 |
[ |
| 57 |
COLUMN_LIST_HEADER, |
| 58 |
COLUMN_INFORMATION1, |
| 59 |
COLUMN_INFORMATION2, |
| 60 |
... |
| 61 |
] |
| 62 |
] |
| 63 |
|
| 64 |
``HEADER`` |
| 65 |
^^^^^^^^^^ |
| 66 |
|
| 67 |
See :doc:`/reference/command/output_format` about ``HEADER``. |
| 68 |
|
| 69 |
``COLUMN_LIST_HEADER`` |
| 70 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 71 |
|
| 72 |
``COLUMN_LIST_HEADER`` describes about content of each |
| 73 |
:ref:`column-list-column-information`. |
| 74 |
|
| 75 |
``COLUMN_LIST_HEADER`` uses the following format: |
| 76 |
|
| 77 |
.. code-block:: json |
| 78 |
|
| 79 |
[ |
| 80 |
["id", "UInt32"], |
| 81 |
["name", "ShortText"], |
| 82 |
["path", "ShortText"], |
| 83 |
["type", "ShortText"], |
| 84 |
["flags", "ShortText"], |
| 85 |
["domain", "ShortText"], |
| 86 |
["range", "ShortText"], |
| 87 |
["source", "ShortText"] |
| 88 |
["generator", "ShortText"] |
| 89 |
] |
| 90 |
|
| 91 |
It means the following: |
| 92 |
|
| 93 |
* The first content in :ref:`column-list-column-information` is |
| 94 |
``id`` value and the value type is ``UInt32``. |
| 95 |
* The second content in :ref:`column-list-column-information` is |
| 96 |
``name`` value and the value type is ``ShortText``. |
| 97 |
* The third content :ref:`column-list-column-information` is .... |
| 98 |
|
| 99 |
This field provides meta-data of column information. So this field |
| 100 |
will be useful for programs rather than humans. |
| 101 |
|
| 102 |
.. _column-list-column-information: |
| 103 |
|
| 104 |
``COLUMN_INFORMATION`` |
| 105 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 106 |
|
| 107 |
Each ``COLUMN_INFORMATION`` uses the following format:: |
| 108 |
|
| 109 |
[ |
| 110 |
ID, |
| 111 |
NAME, |
| 112 |
PATH, |
| 113 |
TYPE, |
| 114 |
FLAGS, |
| 115 |
DOMAIN, |
| 116 |
RANGE, |
| 117 |
SOURCES, |
| 118 |
GENERATOR |
| 119 |
] |
| 120 |
|
| 121 |
``ID`` |
| 122 |
"""""" |
| 123 |
|
| 124 |
The column ID in the Groonga database. Normally, you don't care about |
| 125 |
it. |
| 126 |
|
| 127 |
``NAME`` |
| 128 |
"""""""" |
| 129 |
|
| 130 |
The column name. |
| 131 |
|
| 132 |
``PATH`` |
| 133 |
"""""""" |
| 134 |
|
| 135 |
The path for storing column data. |
| 136 |
|
| 137 |
``TYPE`` |
| 138 |
"""""""" |
| 139 |
|
| 140 |
The type of the column. It is one of the followings: |
| 141 |
|
| 142 |
.. list-table:: |
| 143 |
:header-rows: 1 |
| 144 |
|
| 145 |
* - Value |
| 146 |
- Description |
| 147 |
* - ``fix`` |
| 148 |
- The column is a fixed size column. Scalar column that its |
| 149 |
type is fixed size type is fixed size column. |
| 150 |
* - ``var`` |
| 151 |
- The column is a variable size column. Vector column or |
| 152 |
scalar column that its type is variable size type are |
| 153 |
variable size column. |
| 154 |
* - ``index`` |
| 155 |
- The column is an index column. |
| 156 |
|
| 157 |
``FLAGS`` |
| 158 |
""""""""" |
| 159 |
|
| 160 |
The flags of the column. Each flag is separated by ``|`` like |
| 161 |
``COLUMN_VECTOR|WITH_WEIGHT``. ``FLAGS`` must include one of |
| 162 |
``COLUMN_SCALAR``, ``COLUMN_VECTOR`` or ``COLUMN_INDEX``. Other |
| 163 |
flags are optional. |
| 164 |
|
| 165 |
Here is the available flags: |
| 166 |
|
| 167 |
.. list-table:: |
| 168 |
:header-rows: 1 |
| 169 |
|
| 170 |
* - Flag |
| 171 |
- Description |
| 172 |
* - ``COLUMN_SCALAR`` |
| 173 |
- The column is a scalar column. |
| 174 |
* - ``COLUMN_VECTOR`` |
| 175 |
- The column is a vector column. |
| 176 |
* - ``COLUMN_INDEX`` |
| 177 |
- The column is an index column. |
| 178 |
* - ``WITH_WEIGHT`` |
| 179 |
- The column can have weight. ``COLUMN_VECTOR`` and ``COLUMN_INDEX`` |
| 180 |
may have it. ``COLUMN_SCALAR`` doesn't have it. |
| 181 |
* - ``WITH_SECTION`` |
| 182 |
- The column can have section information. ``COLUMN_INDEX`` |
| 183 |
may have it. ``COLUMN_SCALAR`` and ``COLUMN_VECTOR`` don't |
| 184 |
have it. |
| 185 |
|
| 186 |
Multiple column index has it. |
| 187 |
* - ``WITH_POSITION`` |
| 188 |
- The column can have position information. ``COLUMN_INDEX`` |
| 189 |
may have it. ``COLUMN_SCALAR`` and ``COLUMN_VECTOR`` don't |
| 190 |
have it. |
| 191 |
|
| 192 |
Full text search index must has it. |
| 193 |
* - ``PERSISTENT`` |
| 194 |
- The column is a persistent column. It means that the column |
| 195 |
isn't a :doc:`/reference/columns/pseudo`. |
| 196 |
|
| 197 |
``DOMAIN`` |
| 198 |
"""""""""" |
| 199 |
|
| 200 |
The name of table that has the column. |
| 201 |
|
| 202 |
``RANGE`` |
| 203 |
""""""""" |
| 204 |
|
| 205 |
The value type name of the column. It is a type name or a table name. |
| 206 |
|
| 207 |
``SOURCES`` |
| 208 |
""""""""""" |
| 209 |
|
| 210 |
An array of the source column names of the index column or the |
| 211 |
generated column. |
| 212 |
|
| 213 |
If the index column is a multiple column index, the array has two or |
| 214 |
more source column names. |
| 215 |
|
| 216 |
``GENERATOR`` |
| 217 |
""""""""""""" |
| 218 |
|
| 219 |
.. versionadded:: 14.1.0 |
| 220 |
|
| 221 |
The generator expression in :doc:`../grn_expr/script_syntax`. |
| 222 |
|
| 223 |
This is not an empty string only when the column is a |
| 224 |
:ref:`generated-column`. This is an empty string otherwise. |
| 225 |
|
| 226 |
See also |
| 227 |
-------- |
| 228 |
|
| 229 |
* :doc:`/reference/commands/column_create` |
| 230 |
* :doc:`/reference/column` |