7.3.56. schema
#
7.3.56.1. Summary#
Added in version 5.0.9.
schema
command returns schema in the database.
This command is useful when you want to inspect the database. For example, visualizing the database, creating GUI for the database and so on.
7.3.56.2. Syntax#
This command takes no parameters:
schema
7.3.56.3. Usage#
Here is an example schema to show example output:
Execution example:
table_create Memos TABLE_HASH_KEY ShortText
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Memos content COLUMN_SCALAR Text
# [[0,1337566253.89858,0.000355720520019531],true]
table_create Terms TABLE_PAT_KEY ShortText \
--default_tokenizer TokenBigram \
--normalizer NormalizerAuto
# [[0,1337566253.89858,0.000355720520019531],true]
column_create Terms memos_content_index \
COLUMN_INDEX|WITH_POSITION \
Memos content
# [[0,1337566253.89858,0.000355720520019531],true]
Here is an output of schema
command against this example schema:
Execution example:
schema
# [
# [
# 0,
# 1337566253.89858,
# 0.000355720520019531
# ],
# {
# "plugins": {
# },
# "types": {
# "BFloat16": {
# "id": 20,
# "name": "BFloat16",
# "size": 2,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Bool": {
# "id": 3,
# "name": "Bool",
# "size": 1,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Float": {
# "id": 12,
# "name": "Float",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Float32": {
# "id": 19,
# "name": "Float32",
# "size": 4,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Int16": {
# "id": 6,
# "name": "Int16",
# "size": 2,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Int32": {
# "id": 8,
# "name": "Int32",
# "size": 4,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Int64": {
# "id": 10,
# "name": "Int64",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "Int8": {
# "id": 4,
# "name": "Int8",
# "size": 1,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "LongText": {
# "id": 16,
# "name": "LongText",
# "size": 2147483648,
# "can_be_key_type": false,
# "can_be_value_type": false
# },
# "Object": {
# "id": 2,
# "name": "Object",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "ShortText": {
# "id": 14,
# "name": "ShortText",
# "size": 4096,
# "can_be_key_type": true,
# "can_be_value_type": false
# },
# "Text": {
# "id": 15,
# "name": "Text",
# "size": 65536,
# "can_be_key_type": false,
# "can_be_value_type": false
# },
# "Time": {
# "id": 13,
# "name": "Time",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "TokyoGeoPoint": {
# "id": 17,
# "name": "TokyoGeoPoint",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "UInt16": {
# "id": 7,
# "name": "UInt16",
# "size": 2,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "UInt32": {
# "id": 9,
# "name": "UInt32",
# "size": 4,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "UInt64": {
# "id": 11,
# "name": "UInt64",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "UInt8": {
# "id": 5,
# "name": "UInt8",
# "size": 1,
# "can_be_key_type": true,
# "can_be_value_type": true
# },
# "WGS84GeoPoint": {
# "id": 18,
# "name": "WGS84GeoPoint",
# "size": 8,
# "can_be_key_type": true,
# "can_be_value_type": true
# }
# },
# "tokenizers": {
# "TokenBigram": {
# "id": 67,
# "name": "TokenBigram"
# },
# "TokenBigramIgnoreBlank": {
# "id": 72,
# "name": "TokenBigramIgnoreBlank"
# },
# "TokenBigramIgnoreBlankSplitSymbol": {
# "id": 73,
# "name": "TokenBigramIgnoreBlankSplitSymbol"
# },
# "TokenBigramIgnoreBlankSplitSymbolAlpha": {
# "id": 74,
# "name": "TokenBigramIgnoreBlankSplitSymbolAlpha"
# },
# "TokenBigramIgnoreBlankSplitSymbolAlphaDigit": {
# "id": 75,
# "name": "TokenBigramIgnoreBlankSplitSymbolAlphaDigit"
# },
# "TokenBigramSplitSymbol": {
# "id": 69,
# "name": "TokenBigramSplitSymbol"
# },
# "TokenBigramSplitSymbolAlpha": {
# "id": 70,
# "name": "TokenBigramSplitSymbolAlpha"
# },
# "TokenBigramSplitSymbolAlphaDigit": {
# "id": 71,
# "name": "TokenBigramSplitSymbolAlphaDigit"
# },
# "TokenDelimit": {
# "id": 65,
# "name": "TokenDelimit"
# },
# "TokenDelimitNull": {
# "id": 76,
# "name": "TokenDelimitNull"
# },
# "TokenDocumentVectorBM25": {
# "id": 82,
# "name": "TokenDocumentVectorBM25"
# },
# "TokenDocumentVectorTFIDF": {
# "id": 81,
# "name": "TokenDocumentVectorTFIDF"
# },
# "TokenMecab": {
# "id": 64,
# "name": "TokenMecab"
# },
# "TokenNgram": {
# "id": 78,
# "name": "TokenNgram"
# },
# "TokenPattern": {
# "id": 79,
# "name": "TokenPattern"
# },
# "TokenRegexp": {
# "id": 77,
# "name": "TokenRegexp"
# },
# "TokenTable": {
# "id": 80,
# "name": "TokenTable"
# },
# "TokenTrigram": {
# "id": 68,
# "name": "TokenTrigram"
# },
# "TokenUnigram": {
# "id": 66,
# "name": "TokenUnigram"
# }
# },
# "normalizers": {
# "NormalizerAuto": {
# "id": 83,
# "name": "NormalizerAuto"
# },
# "NormalizerHTML": {
# "id": 90,
# "name": "NormalizerHTML"
# },
# "NormalizerNFKC100": {
# "id": 85,
# "name": "NormalizerNFKC100"
# },
# "NormalizerNFKC121": {
# "id": 86,
# "name": "NormalizerNFKC121"
# },
# "NormalizerNFKC130": {
# "id": 87,
# "name": "NormalizerNFKC130"
# },
# "NormalizerNFKC150": {
# "id": 88,
# "name": "NormalizerNFKC150"
# },
# "NormalizerNFKC51": {
# "id": 84,
# "name": "NormalizerNFKC51"
# },
# "NormalizerTable": {
# "id": 89,
# "name": "NormalizerTable"
# }
# },
# "token_filters": {
# "TokenFilterNFKC100": {
# "id": 230,
# "name": "TokenFilterNFKC100"
# },
# "TokenFilterNFKC121": {
# "id": 231,
# "name": "TokenFilterNFKC121"
# },
# "TokenFilterNFKC130": {
# "id": 232,
# "name": "TokenFilterNFKC130"
# },
# "TokenFilterNFKC150": {
# "id": 233,
# "name": "TokenFilterNFKC150"
# }
# },
# "tables": {
# "Memos": {
# "id": 256,
# "name": "Memos",
# "type": "hash table",
# "key_type": {
# "id": 14,
# "name": "ShortText",
# "type": "type"
# },
# "value_type": null,
# "tokenizer": null,
# "normalizer": null,
# "normalizers": [
#
# ],
# "token_filters": [
#
# ],
# "indexes": [
#
# ],
# "command": {
# "name": "table_create",
# "arguments": {
# "name": "Memos",
# "flags": "TABLE_HASH_KEY",
# "key_type": "ShortText"
# },
# "command_line": "table_create --name Memos --flags TABLE_HASH_KEY --key_type ShortText"
# },
# "columns": {
# "content": {
# "id": 257,
# "name": "content",
# "table": "Memos",
# "full_name": "Memos.content",
# "type": "scalar",
# "value_type": {
# "id": 15,
# "name": "Text",
# "type": "type"
# },
# "compress": null,
# "missing": "add",
# "invalid": "error",
# "section": false,
# "weight": false,
# "weight_float32": false,
# "weight_bfloat16": false,
# "position": false,
# "sources": [
#
# ],
# "generator": "",
# "indexes": [
# {
# "id": 259,
# "full_name": "Terms.memos_content_index",
# "table": "Terms",
# "name": "memos_content_index",
# "section": 0
# }
# ],
# "command": {
# "name": "column_create",
# "arguments": {
# "table": "Memos",
# "name": "content",
# "flags": "COLUMN_SCALAR",
# "type": "Text"
# },
# "command_line": "column_create --table Memos --name content --flags COLUMN_SCALAR --type Text"
# }
# }
# }
# },
# "Terms": {
# "id": 258,
# "name": "Terms",
# "type": "patricia trie",
# "key_type": {
# "id": 14,
# "name": "ShortText",
# "type": "type"
# },
# "value_type": null,
# "tokenizer": {
# "id": 67,
# "name": "TokenBigram",
# "options": null
# },
# "normalizer": {
# "id": 83,
# "name": "NormalizerAuto",
# "options": null
# },
# "normalizers": [
# {
# "id": 83,
# "name": "NormalizerAuto",
# "options": null
# }
# ],
# "token_filters": [
#
# ],
# "indexes": [
#
# ],
# "command": {
# "name": "table_create",
# "arguments": {
# "name": "Terms",
# "flags": "TABLE_PAT_KEY",
# "key_type": "ShortText",
# "default_tokenizer": "TokenBigram",
# "normalizer": "NormalizerAuto"
# },
# "command_line": "table_create --name Terms --flags TABLE_PAT_KEY --key_type ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto"
# },
# "columns": {
# "memos_content_index": {
# "id": 259,
# "name": "memos_content_index",
# "table": "Terms",
# "full_name": "Terms.memos_content_index",
# "type": "index",
# "value_type": {
# "id": 256,
# "name": "Memos",
# "type": "reference"
# },
# "compress": null,
# "missing": null,
# "invalid": null,
# "section": false,
# "weight": false,
# "weight_float32": false,
# "weight_bfloat16": false,
# "position": true,
# "sources": [
# {
# "id": 257,
# "name": "content",
# "table": "Memos",
# "full_name": "Memos.content"
# }
# ],
# "generator": "",
# "indexes": [
#
# ],
# "command": {
# "name": "column_create",
# "arguments": {
# "table": "Terms",
# "name": "memos_content_index",
# "flags": "COLUMN_INDEX|WITH_POSITION",
# "type": "Memos",
# "source": "content"
# },
# "command_line": "column_create --table Terms --name memos_content_index --flags COLUMN_INDEX|WITH_POSITION --type Memos --source content"
# }
# }
# }
# }
# }
# }
# ]
7.3.56.4. Parameters#
This section describes all parameters.
7.3.56.4.1. Required parameters#
There is no required parameter.
7.3.56.4.2. Optional parameters#
There is no optional parameter.
7.3.56.5. Return value#
schema
command returns schema in the database:
[HEADER, SCHEMA]
7.3.56.5.1. HEADER
#
See Output format about HEADER
.
7.3.56.5.2. SCHEMA
#
SCHEMA
is an object that consists of the following information:
{
"plugins": PLUGINS,
"types": TYPES,
"tokenizers": TOKENIZERS,
"normalizers": NORMALIZERS,
"token_filters": TOKEN_FITLERS,
"tables": TABLES
}
7.3.56.5.3. PLUGINS
#
PLUGINS
is an object. Its key is plugin name and its value is
plugin detail:
{
"PLUGIN_NAME_1": PLUGIN_1,
"PLUGIN_NAME_2": PLUGIN_2,
...
"PLUGIN_NAME_n": PLUGIN_n
}
7.3.56.5.4. PLUGIN
#
PLUGIN
is an object that describes plugin detail:
{
"name": PLUGIN_NAME
}
Here are properties of PLUGIN
:
Name |
Description |
---|---|
|
The plugin name. It’s used in plugin_register. |
7.3.56.5.5. TYPES
#
TYPES
is an object. Its key is type name and its value is
type detail:
{
"TYPE_NAME_1": TYPE_1,
"TYPE_NAME_2": TYPE_2,
...
"TYPE_NAME_n": TYPE_n
}
7.3.56.5.6. TYPE
#
TYPE
is an object that describes type detail:
{
"name": TYPE_NAME,
"size": SIZE_OF_ONE_VALUE_IN_BYTE,
"can_be_key_type": BOOLEAN,
"can_be_value_type": BOOLEAN
}
Here are properties of TYPE
:
Name |
Description |
---|---|
|
The type name. |
|
The number of bytes of one value. |
|
|
|
|
7.3.56.5.7. TOKENIZERS
#
TOKENIZERS
is an object. Its key is tokenizer name and its value
is tokenizer detail:
{
"TOKENIZER_NAME_1": TOKENIZER_1,
"TOKENIZER_NAME_2": TOKENIZER_2,
...
"TOKENIZER_NAME_n": TOKENIZER_n
}
7.3.56.5.8. TOKENIZER
#
TOKENIZER
is an object that describes tokenizer detail:
{
"name": TOKENIZER_NAME
}
Here are properties of TOKENIZER
:
Name |
Description |
---|---|
|
The tokenizer name. It’s used for default_tokenizer. |
7.3.56.5.9. NORMALIZERS
#
NORMALIZERS
is an object. Its key is normalizer name and its value
is normalizer detail:
{
"NORMALIZER_NAME_1": NORMALIZER_1,
"NORMALIZER_NAME_2": NORMALIZER_2,
...
"NORMALIZER_NAME_n": NORMALIZER_n
}
7.3.56.5.10. NORMALIZER
#
NORMALIZER
is an object that describes normalizer detail:
{
"name": NORMALIZER_NAME
}
Here are properties of NORMALIZER
:
Name |
Description |
---|---|
|
The normalizer name. It’s used for normalizer. |
7.3.56.5.11. TOKEN_FILTERS
#
TOKEN_FILTERS
is an object. Its key is token filter name and its value
is token filter detail:
{
"TOKEN_FILTER_NAME_1": TOKEN_FILTER_1,
"TOKEN_FILTER_NAME_2": TOKEN_FILTER_2,
...
"TOKEN_FILTER_NAME_n": TOKEN_FILTER_n
}
7.3.56.5.12. TOKEN_FILTER
#
TOKEN_FILTER
is an object that describes token filter detail:
{
"name": TOKEN_FILTER_NAME
}
Here are properties of TOKEN_FILTER
:
Name |
Description |
---|---|
|
The token filter name. It’s used for token_filters. |
7.3.56.5.13. TABLES
#
TABLES
is an object. Its key is table name and its value
is table detail:
{
"TABLE_NAME_1": TABLE_1,
"TABLE_NAME_2": TABLE_2,
...
"TABLE_NAME_n": TABLE_n
}
7.3.56.5.14. TABLE
#
TABLE
is an object that describes table detail:
{
"name": TABLE_NAME
"type": TYPE,
"key_type": KEY_TYPE,
"value_type": VALUE_TYPE,
"tokenizer": TOKENIZER,
"normalizer": NORMALIZER,
"token_filters": [
TOKEN_FILTER_1,
TOKEN_FILTER_2,
...,
TOKEN_FILTER_n,
],
"indexes": [
INDEX_1,
INDEX_2,
...,
INDEX_n
],
"command": COMMAND,
"columns": {
"COLUMN_NAME_1": COLUMN_1,
"COLUMN_NAME_2": COLUMN_2,
...,
"COLUMN_NAME_3": COLUMN_3,
}
}
Here are properties of TABLE
:
Name |
Description |
---|---|
|
The table name. |
|
The table type. This is one of the followings:
|
|
The type of the table’s key. If the table type is If the table type isn’t
|
|
The type of the table’s value. If the table doesn’t use value, this is If the table uses value, this is an object that has the following properties:
|
|
The tokenizer of the table. It’s specified by default_tokenizer. If the table doesn’t use tokenizer, this is If the table uses tokenizer, this is an object that has the following properties:
|
|
The normalizer of the table. It’s specified by normalizer. If the table doesn’t use normalizer, this is If the table uses normalizer, this is an object that has the following properties:
|
|
The token filters of the table. It’s specified by token_filters. This is an array of an object. The object has the following properties:
|
|
The indexes of the table’s key. This is an array of INDEX. |
|
The Groonga command information to create the table. This is COMMAND. |
|
The columns of the table. This is an object that its key is a column name and its value is COLUMN. |
7.3.56.5.15. INDEX
#
INDEX
is an object that describes index detail:
{
"full_name": INDEX_COLUMN_NAME_WITH_TABLE_NAME,
"table": TABLE_NAME,
"name": INDEX_COLUMN_NAME,
"section": SECTION
}
Here are properties of INDEX
:
Name |
Description |
---|---|
|
The index column name with table name. For example, |
|
The table name of the index column. For example, |
|
The index column name. For example, |
|
The section number in the index column for the table’s key. If the index column isn’t multiple column index, this is |
7.3.56.5.16. COMMAND
#
COMMAND
is an object that describes how to create the table or
column:
{
"name": COMMAND_NAME,
"arguments": {
"KEY_1": "VALUE_1",
"KEY_2": "VALUE_2",
...,
"KEY_n": "VALUE_n"
},
"command_line": COMMAND_LINE
}
Here are properties of COMMAND
:
Name |
Description |
---|---|
|
The Groonga command name to create the table or column. |
|
The arguments of the Groonga command to create the table or column. This is an object that its key is argument name and its value is argument value. |
|
The Groonga command line to create the table or column. This is a string that can be evaluated by Groonga. |
7.3.56.5.17. COLUMN
#
COLUMN
is an object that describes column detail:
{
"name": COLUMN_NAME,
"table": TABLE_NAME,
"full_name": COLUMN_NAME_WITH_TABLE,
"type": TYPE,
"value_type": VALUE_TYPE,
"compress": COMPRESS,
"section": SECTION,
"weight": WEIGHT,
"compress": COMPRESS,
"section": BOOLEAN,
"weight": BOOLEAN,
"position": BOOLEAN,
"sources": [
SOURCE_1,
SOURCE_2,
...,
SOURCE_n
],
"generator": GENERATOR,
"indexes": [
INDEX_1,
INDEX_2,
...,
INDEX_n
],
"command": COMMAND
}
Here are properties of COLUMN
:
Name |
Description |
---|---|
|
The column name. For example, |
|
The table name of the column. For example, |
|
The column name with table name. For example, |
|
The column type. This is one of the followings:
|
|
The type of the column’s value. This is an object that has the following properties:
|
|
The compression method of the column. If the column doesn’t use any compression methods, this is
If the column uses a compression method, this is one of the followings:
|
|
Whether the column can store section information or not.
Normally, if the column isn’t an index column, this is |
|
Whether the column can store weight information or not.
|
|
Whether the column can store position information or not.
Normally, if the column isn’t an index column, this is |
|
The source columns of the index column. This is an array of SOURCE. If the column is an index column or a Generated column, this has one or more elements. Otherwise, this is an empty array. |
|
Added in version 14.1.0. The generator expression in Script syntax. If the column is not a Generated column, this is an empty string. |
|
The indexes of the column. This is an array of INDEX. |
|
The Groonga command information to create the column. This is COMMAND. |
7.3.56.5.18. SOURCE
#
SOURCE
is an object that describes source detail:
{
"name": COLUMN_NAME,
"table": TABLE_NAME,
"full_name": COLUMN_NAME_WITH_TABLE_NAME
}
Here are properties of SOURCE
:
Name |
Description |
---|---|
|
The source column name. For example, This may be a |
|
The table name of the source column. For example, |
|
The source column name with table name. For example, |