Debian Codegraph @

doc/source/reference/commands/object_list.rst

raw
1 .. -*- rst -*-
2
3 .. groonga-command
4 .. database: commands_object_list
5
6 ``object_list``
7 ===============
8
9 Summary
10 -------
11
12 .. versionadded:: 6.0.7
13
14 ``object_list`` lists objects in database. Object information is taken
15 from metadata in database. ``object_list`` doesn't open any
16 objects. So ``object_list`` is a light command for database that has
17 many tables and/or columns.
18
19 Normally, :doc:`schema` is a useful command than
20 ``object_list``. Because :doc:`schema` returns more information than
21 ``object_list``.
22
23 Syntax
24 ------
25
26 This command takes no parameters::
27
28 object_list
29
30 Usage
31 -----
32
33 Here is an example schema to show example output:
34
35 .. groonga-command
36 .. include:: ../../example/reference/commands/object_list/sample.log
37 .. table_create Memos TABLE_HASH_KEY ShortText
38 .. column_create Memos content COLUMN_SCALAR Text
39 ..
40 .. table_create Terms TABLE_PAT_KEY ShortText \
41 .. --default_tokenizer TokenBigram \
42 .. --normalizer NormalizerAuto
43 .. column_create Terms memos_content_index \
44 .. COLUMN_INDEX|WITH_POSITION \
45 .. Memos content
46
47 Here is an output of ``object_list`` command against this database:
48
49 .. groonga-command
50 .. include:: ../../example/reference/commands/object_list/output.log
51 .. object_list
52
53 Parameters
54 ----------
55
56 This section describes all parameters.
57
58 Required parameters
59 ^^^^^^^^^^^^^^^^^^^
60
61 There is no required parameter.
62
63 Optional parameters
64 ^^^^^^^^^^^^^^^^^^^
65
66 There is no optional parameter.
67
68 Return value
69 ------------
70
71 ``object_list`` command returns a list of object information in the
72 database::
73
74 [HEADER, OBJECTS]
75
76 ``HEADER``
77 ^^^^^^^^^^
78
79 See :doc:`/reference/command/output_format` about ``HEADER``.
80
81 ``OBJECTS``
82 ^^^^^^^^^^^
83
84 ``OBJECTS`` are pairs of object name and object details::
85
86 {
87 "OBJECT_1": OBJECT_1,
88 "OBJECT_2": OBJECT_2,
89 ...,
90 "OBJECT_n": OBJECT_n,
91 }
92
93 Each ``OBJECT`` consists of common properties and object type specific
94 properties.
95
96 ``OBJECT`` (common properties)
97 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98
99 Here are common properties::
100
101 {
102 "id": ID,
103 "name": NAME,
104 "opened": OPENED,
105 "value_size": N_BYTES,
106 "n_elements": N_ELEMENTS,
107 "type": OBJECT_TYPE,
108 "flags": FLAGS,
109 "path": PATH
110 }
111
112 .. list-table::
113 :header-rows: 1
114
115 * - Name
116 - Description
117 * - ``id``
118 - The ID of the object.
119 * - ``name``
120 - The name of the object.
121 * - ``opened``
122 - Whether the object is opened or not. It's ``true`` or
123 ``false``. If the object is opened, this value is
124 ``true``. Otherwise, this value is ``false``.
125 * - ``value_size``
126 - The number of bytes of the metadata. It's an integer.
127
128 It's appeared only when the metadata are broken. If this
129 property is appeared, ``type``, ``n_elements``, ``flags`` and
130 ``path`` aren't appeared. Because they can't be retrieved from
131 broken metadata.
132 * - ``n_elements``
133 - The number of internal elements in the metadata. It's an
134 integer.
135 * - ``type``
136 - The type of the object. See
137 :ref:`object-list-return-value-object-type` for details.
138 * - ``flags``
139 - The flags of the object. See
140 :ref:`object-list-return-value-flags` for details.
141 * - ``path``
142 - The path that contains data of the object. It's ``null`` for
143 objects that doesn't have data. For example, command object
144 doesn't have data.
145
146 .. _object-list-return-value-object-type:
147
148 ``OBJECT_TYPE``
149 ^^^^^^^^^^^^^^^
150
151 ``OBJECT_TYPE`` represents the type of object. For example, patricia
152 trie table, hash table and index column are object types.
153
154 ``OBJECT_TYPE`` has the following properties::
155
156 {
157 "id": ID,
158 "name": NAME
159 }
160
161 .. list-table::
162 :header-rows: 1
163
164 * - Name
165 - Description
166 * - ``id``
167 - The ID of the type.
168 * - ``name``
169 - The name of the type. For example, :ref:`table-hash-key` is
170 ``"table:hash_key"``, :doc:`/reference/columns/vector` is
171 ``"column:var_size"`` and :doc:`/reference/columns/index` is
172 ``"column:index"``.
173
174 .. _object-list-return-value-flags:
175
176 ``FLAGS``
177 ^^^^^^^^^
178
179 ``FLAGS`` represents the flags of object. The most flags are the
180 specified flags in :doc:`table_create` or :doc:`column_create`. Some
181 flags are added internally.
182
183 ``FLAGS`` has the following properties::
184
185 {
186 "value": VALUE,
187 "names": NAMES
188 }
189
190 .. list-table::
191 :header-rows: 1
192
193 * - Name
194 - Description
195 * - ``value``
196 - The value of the flags. It's an integer.
197 * - ``names``
198 - The names of each flag. It's a string. Each name is separated
199 by ``|`` such as ``TABLE_HASH_KEY|PERSISTENT``.
200
201 ``OBJECT`` (``"type"`` object type specific properties)
202 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
203
204 Here are ``"type"`` object type specific properties in ``OBJECT``::
205
206 {
207 "size": SIZE
208 }
209
210 .. list-table::
211 :header-rows: 1
212
213 * - Name
214 - Description
215 * - ``size``
216 - The size of the type. If the type is fixed size type, the size
217 is the size of each value. If the type is variable size type,
218 the size is the maximum size of each value.
219
220 ``OBJECT`` (``"proc"`` object type specific properties)
221 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
223 Here is a list of object that is ``"proc"`` object type:
224
225 * :doc:`/reference/command`
226 * :doc:`/reference/function`
227 * :doc:`/reference/normalizers`
228 * :doc:`/reference/tokenizers`
229 * :doc:`/reference/token_filters`
230
231 Here are ``"proc"`` object type specific properties in ``OBJECT``::
232
233 {
234 "plugin_id": PLUGIN_ID
235 }
236
237 .. list-table::
238 :header-rows: 1
239
240 * - Name
241 - Description
242 * - ``plugin_id``
243 - The plugin ID of the ``"proc"`` object. If the ``"proc"``
244 object is defined by plugin, the value is ``1`` or more larger
245 integer. Plugin ID is ``0`` for builtin ``"proc"`` object.
246
247 ``OBJECT`` (``"table:*"`` object types specific properties)
248 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249
250 Here are ``"table:*"`` object types specific properties in
251 ``OBJECT``::
252
253 {
254 "range": RANGE,
255 "token_filters": TOKEN_FILTERS
256 }
257
258 .. list-table::
259 :header-rows: 1
260
261 * - Name
262 - Description
263 * - ``range``
264 - The type of the table's value. See
265 :ref:`object-list-return-value-range` for details.
266 * - ``token_filters``
267 - The token filters of the table. See
268 :ref:`object-list-return-value-token-filters` for details.
269
270 .. _object-list-return-value-range:
271
272 ``RANGE``
273 ^^^^^^^^^
274
275 ``RANGE`` represents the type of the range.
276
277 ``RANGE`` has the following properties::
278
279 {
280 "id": ID,
281 "name": NAME
282 }
283
284 .. list-table::
285 :header-rows: 1
286
287 * - Name
288 - Description
289 * - ``id``
290 - The ID of the type of the range. It's an integer. If the object
291 doesn't have range, ID is ``0``.
292 * - ``name``
293 - The name of the type of the range. It's a string or ``null``.
294 If the object doesn't have range, name is ``null``.
295
296 .. _object-list-return-value-token-filters:
297
298 ``TOKEN_FILTERS``
299 ^^^^^^^^^^^^^^^^^
300
301 ``TOKEN_FILTERS`` represents the token filters of the table.
302
303 ``TOKEN_FILTERS`` is an array of ``TOKEN_FILTER``::
304
305 [
306 TOKEN_FILTER_1,
307 TOKEN_FILTER_2,
308 ...,
309 TOKEN_FILTER_n
310 ]
311
312 ``TOKEN_FILTER`` has the following properties::
313
314 {
315 "id": ID,
316 "NAME": NAME
317 }
318
319 .. list-table::
320 :header-rows: 1
321
322 * - Name
323 - Description
324 * - ``id``
325 - The ID of the token filter. It's an integer.
326 * - ``name``
327 - The name of the token filter. It's a string.
328
329 ``OBJECT`` (``"column:*"`` object types specific properties)
330 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
331
332 Here are ``"column:*"`` object types specific properties in
333 ``OBJECT``::
334
335 {
336 "range": RANGE,
337 "sources": SOURCES
338 }
339
340 .. list-table::
341 :header-rows: 1
342
343 * - Name
344 - Description
345 * - ``range``
346 - The type of the column's value. See
347 :ref:`object-list-return-value-range` for details.
348 * - ``sources``
349 - The sources of the index column. See
350 :ref:`object-list-return-value-sources` for details.
351
352 ``OBJECT`` (``"column:fix"`` and ``"column:var"`` object types specific properties)
353 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
354
355 Here are ``"column:fix"`` and ``"column:var"`` object type specific
356 properties in ``OBJECT``::
357
358 {
359 "generator": GENERATOR
360 }
361
362 .. list-table::
363 :header-rows: 1
364
365 * - Name
366 - Description
367 * - ``range``
368 - .. versionadded:: 14.1.0
369
370 The generator expression in :doc:`../grn_expr/script_syntax`.
371
372 If the column is not a :ref:`generated-column`, this is an
373 empty string.
374
375 .. _object-list-return-value-sources:
376
377 ``SOURCES``
378 ^^^^^^^^^^^
379
380 ``SOURCES`` represents the sources of an index column or a generated
381 column.
382
383 ``SOURCES`` is an array of ``SOURCE``::
384
385 [
386 SOURCE_1,
387 SOURCE_2,
388 ...,
389 SOURCE_n
390 ]
391
392 ``SOURCE`` has the following properties::
393
394 {
395 "id": ID,
396 "NAME": NAME
397 }
398
399 .. list-table::
400 :header-rows: 1
401
402 * - Name
403 - Description
404 * - ``id``
405 - The ID of the source table or column. It's an integer.
406 * - ``name``
407 - The name of the source table or column. It's a string.
408
409 See also
410 --------
411
412 * :doc:`schema`