Skip to content

Commit

Permalink
add-schema-name-restrictions (#2040)
Browse files Browse the repository at this point in the history
* add-schema-name-restrictions

* add a restriction for adding Chinese schema names

* Update docs-2.0/3.ngql-guide/10.tag-statements/1.create-tag.md

Co-authored-by: randomJoe211 <[email protected]>

---------

Co-authored-by: randomJoe211 <[email protected]>
  • Loading branch information
abby-cyber and randomJoe211 authored Apr 25, 2023
1 parent 949fa2f commit 8ac98ea
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/10.tag-statements/1.create-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TAG [IF NOT EXISTS] <tag_name>
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the tag that you want to create exists. If it does not exist, a new one will be created. The tag existence detection here only compares the tag names (excluding properties).|
|`<tag_name>`|1. The tag name must be **unique** in a graph space.<br> 2. Once the tag name is set, it can not be altered.<br> 3. The name of the tag supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), digits, and Chinese characters, but does not support special characters except underscores. To use special characters (the period character (.) is excluded) or reserved keywords as identifiers, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).|
|`<tag_name>`|1. Each tag name in the graph space must be **unique**. <br>2. Tag names cannot be modified after they are set.<br>3. Tag names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not support special characters other than underscores. To use special characters, reserved keywords, or start with a number in a tag name, enclose them in backticks (\`), and do not use periods (`.`) in a tag name. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a tag in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<prop_name>`|The name of the property. It must be unique for each tag. The rules for permitted property names are the same as those for tag names.|
|`<data_type>`|Shows the data type of each property. For a full description of the property data types, see [Data types](../3.data-types/1.numeric.md) and [Boolean](../3.data-types/2.boolean.md).|
|`NULL \| NOT NULL`|Specifies if the property supports `NULL | NOT NULL`. The default value is `NULL`. `DEFAULT` must be specified if `NOT NULL` is set.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE EDGE [IF NOT EXISTS] <edge_type_name>
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the edge type that you want to create exists. If it does not exist, a new one will be created. The edge type existence detection here only compares the edge type names (excluding properties).|
|`<edge_type_name>`|The edge type name must be **unique** in a graph space. Once the edge type name is set, it can not be altered. The name of the edge type starts with a letter, supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), digits, and Chinese characters, but does not support special characters except underscores. To use special characters or reserved keywords as identifiers, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).|
|`<edge_type_name>`|1. The edge type name must be **unique** in a graph space.<br/> 2. Once the edge type name is set, it can not be altered.<br/> 3. Edge type names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not include special characters other than underscores. To use special characters, reserved keywords or starting with a number, quote them with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). <br/>**Note**: If you name an edge type in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`<prop_name>`|The name of the property. It must be unique for each edge type. The rules for permitted property names are the same as those for edge type names.|
|`<data_type>`|Shows the data type of each property. For a full description of the property data types, see [Data types](../3.data-types/1.numeric.md) and [Boolean](../3.data-types/2.boolean.md).|
|`NULL \| NOT NULL`|Specifies if the property supports `NULL | NOT NULL`. The default value is `NULL`. `DEFAULT` must be specified if `NOT NULL` is set.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ CREATE {TAG | EDGE} INDEX [IF NOT EXISTS] <index_name> ON {<tag_name> | <edge_na
|:---|:---|
|`TAG | EDGE`|Specifies the index type that you want to create.|
|`IF NOT EXISTS`|Detects if the index that you want to create exists. If it does not exist, a new one will be created.|
|`<index_name>`|The name of the index. It must be unique in a graph space. A recommended way of naming is `i_tagName_propName`. The name of the index starts with a letter, supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), digits, and Chinese characters, but does not support special characters except underscores. To use special characters or reserved keywords as identifiers, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).|
|`<index_name>`|The name of the index. It must be unique in a graph space. A recommended way of naming is `i_tagName_propName`. <br/>Index names cannot start with a number. They supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), numbers, and Chinese characters, but does not support special characters except underscores. To use special characters, reserved keywords, or starting with a number, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).<br/>**Note**: If you name an index in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`). |
|`<tag_name> | <edge_name>`|Specifies the name of the tag or edge associated with the index.|
|`<prop_name_list>`|To index a **variable-length** string property, you must use `prop_name(length)` to specify the index length. To index a tag or an edge type, ignore the `prop_name_list`.|
|`COMMENT`|The remarks of the index. The maximum length is 256 bytes. By default, there will be no comments on an index.|
Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/9.space-statements/1.create-space.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
|Parameter|Description|
|:---|:---|
|`IF NOT EXISTS`|Detects if the related graph space exists. If it does not exist, a new one will be created. The graph space existence detection here only compares the graph space name (excluding properties).|
|`<graph_space_name>`|Uniquely identifies a graph space in a NebulaGraph instance. The name of the graph space starts with a letter, supports 1 to 4 bytes UTF-8 encoded characters, such as English letters (case-sensitive), digits, and Chinese characters, but does not support special characters except underscores. To use special characters or reserved keywords as identifiers, quote them with backticks. For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md).|
|`<graph_space_name>`|1. Uniquely identifies a graph space in a NebulaGraph instance. <br/>2. Space names cannot be modified after they are set.<br/> 3. Space names cannot start with a number; they support 1-4 byte UTF-8 encoded characters, including English letters (case sensitive), numbers, Chinese characters, etc., but do not include special characters other than underscores. To use special characters, reserved keywords or starting with a number, quote them with backticks (\`) and cannot use periods (`.`). For more information, see [Keywords and reserved words](../../3.ngql-guide/1.nGQL-overview/keywords-and-reserved-words.md). **Note**: If you name a space in Chinese and encounter a `SyntaxError`, you need to quote the Chinese characters with backticks (\`).|
|`partition_num`|Specifies the number of partitions in each replica. The suggested value is 20 times (2 times for HDD) the number of the hard disks in the cluster. For example, if you have three hard disks in the cluster, we recommend that you set 60 partitions. The default value is 100.|
|`replica_factor`|Specifies the number of replicas in the cluster. The suggested number is 3 in a production environment and 1 in a test environment. The replica number must be an **odd number** for the need of quorum-based voting. The default value is 1.|
|`vid_type`|A required parameter. Specifies the VID type in a graph space. Available values are `FIXED_STRING(N)` and `INT64`. `INT` equals to `INT64`. <br>``FIXED_STRING(<N>)` specifies the VID as a string, while `INT64` specifies it as an integer. `N` represents the maximum length of the VIDs. If you set a VID that is longer than `N` bytes, NebulaGraph throws an error. Note, for UTF-8 chars, the length may vary in different cases, i.e. a UTF-8 Chinese char is 3 byte, this means 11 Chinese chars(length-33) will exeed a FIXED_STRING(32) vid defination.|
Expand Down

0 comments on commit 8ac98ea

Please sign in to comment.