This is an automated email from the ASF dual-hosted git repository.
wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 470b6b3b637 DistSQL related document formatting (#19774)
470b6b3b637 is described below
commit 470b6b3b6372404cce7cf2276632aab96b3ea17d
Author: Jieker <[email protected]>
AuthorDate: Thu Aug 4 08:14:15 2022 +0800
DistSQL related document formatting (#19774)
* DistSQL related document formatting
* Improve the railroad diagram
* Little adjustment.
* Little adjustment.
---
.../rdl/resource-definition/add-resource.en.md | 2 +-
.../rdl/resource-definition/alter-resource.en.md | 2 +-
.../rdl/resource-definition/drop-resource.cn.md | 5 ++-
.../rdl/resource-definition/drop-resource.en.md | 5 ++-
.../create-default-sharding-strategy.cn.md | 6 ++--
.../create-default-sharding-strategy.en.md | 8 ++---
.../sharding/create-sharding-algorithm.cn.md | 6 ++--
.../sharding/create-sharding-algorithm.en.md | 5 ++-
.../create-sharding-binding-table-rule.cn.md | 9 ++---
.../create-sharding-binding-table-rule.en.md | 18 ++++++----
.../create-sharding-broadcast-table-rule.cn.md | 14 ++++++--
.../create-sharding-broadcast-table-rule.en.md | 17 ++++++---
.../sharding/create-sharding-key-generator.cn.md | 11 +++---
.../sharding/create-sharding-key-generator.en.md | 14 ++++----
.../sharding/create-sharding-table-rule.cn.md | 27 ++++++++------
.../sharding/create-sharding-table-rule.en.md | 42 +++++++++++++++-------
16 files changed, 122 insertions(+), 69 deletions(-)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
index 65e0873a00d..29c607ecd42 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/add-resource.en.md
@@ -92,7 +92,7 @@ ADD RESOURCE ds_2 (
### Reserved word
-`ADD`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+`ADD`, `RESOURCE`, `HOST`, `PORT`, `DB`, `USER`, `PASSWORD`, `PROPERTIES`,
`URL`
### Related links
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
index 3fcd6cde14f..a602c98350e 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/alter-resource.en.md
@@ -94,7 +94,7 @@ ALTER RESOURCE ds_2 (
### Reserved word
-`ALTER`、`RESOURCE`、`HOST`、`PORT`、`DB`、`USER`、`PASSWORD`、`PROPERTIES`、`URL`
+`ALTER`, `RESOURCE`, `HOST`, `PORT`, `DB`, `USER`, `PASSWORD`, `PROPERTIES`,
`URL`
### Related links
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
index 0783fd3135e..da85de0f91b 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
@@ -12,6 +12,9 @@ weight = 4
```sql
DropResource ::=
'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName ( ',' dataSourceName )*
( 'IGNORE' 'SINGLE' 'TABLES' )?
+
+dataSourceName ::=
+ identifier
```
### 补充说明
@@ -48,7 +51,7 @@ DROP RESOURCE IF EXISTS ds_4;
### 保留字
-`DROP`、 `RESOURCE`、 `IF`、 `EXISTS`、 `IGNORE`、 `SINGLE`、 `TABLES`
+`DROP`、`RESOURCE`、`IF`、`EXISTS`、`IGNORE`、`SINGLE`、`TABLES`
### 相关链接
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
index 2050676f5fa..ebdcc91f426 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
@@ -12,6 +12,9 @@ The `DROP RESOURCE` syntax is used to drop resources from the
current database
```sql
DropResource ::=
'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName ( ',' dataSourceName )*
( 'IGNORE' 'SINGLE' 'TABLES' )?
+
+dataSourceName ::=
+ identifier
```
### Supplement
@@ -51,7 +54,7 @@ DROP RESOURCE IF EXISTS ds_2;
### Reserved word
-`DROP`、 `RESOURCE`、 `IF`、 `EXISTS`、 `IGNORE`、 `SINGLE`、 `TABLES`
+`DROP`, `RESOURCE`, `IF`, `EXISTS`, `IGNORE`, `SINGLE`, `TABLES`
### Related links
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.cn.md
index f299cea6a2b..38aa896fbf8 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.cn.md
@@ -9,7 +9,7 @@ weight = 3
### 语法定义
-```SQL
+```sql
CreateDefaultShardingStrategy ::=
'CREATE' 'DEFAULT' 'SHARDING' ('DATABASE' | 'TABLE') 'STRATEGY' '('
shardingStrategy ')'
@@ -34,10 +34,9 @@ algorithmType ::=
### 补充说明
-- 当使用复合分片算法时,需要通过 `SHARDING_COLUMNS` 指定多个分片键
+- 当使用复合分片算法时,需要通过 `SHARDING_COLUMNS` 指定多个分片键
- `algorithmType`
为分片算法类型,详细的分片算法类型信息请参考[分片算法](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/)
-
### 示例
#### 1.通过已有的分片算法创建默认分库策略
@@ -64,4 +63,5 @@ CREATE DEFAULT SHARDING TABLE STRATEGY (
```
### 相关链接
+
- [CREATE SHARDING
ALGORITHM](/cn/reference/distsql/syntax/rdl/rule-definition/create-sharding-algorithm/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.en.md
index b29e873e83f..e900073f00f 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-default-sharding-strategy.en.md
@@ -9,7 +9,7 @@ The `CREATE DEFAULT SHARDING STRATEGY` syntax is used to create
a default shardi
### Syntax
-```SQL
+```sql
CreateDefaultShardingStrategy ::=
'CREATE' 'DEFAULT' 'SHARDING' ('DATABASE' | 'TABLE') 'STRATEGY' '('
shardingStrategy ')'
@@ -35,8 +35,8 @@ algorithmType ::=
### Supplement
- When using the complex sharding algorithm, multiple sharding columns need to
be specified using `SHARDING_COLUMNS`
-- `algorithmType` is the sharding algorithm type. For detailed sharding
algorithm type information, please refer to [Sharding
Algorithm](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/)
-
+- `algorithmType` is the sharding algorithm type. For detailed sharding
algorithm type information, please refer
+ to [Sharding
Algorithm](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/)
### Example
@@ -64,5 +64,5 @@ CREATE DEFAULT SHARDING TABLE STRATEGY (
```
### Related links
-- [CREATE SHARDING
ALGORITHM](/en/reference/distsql/syntax/rdl/rule-definition/create-sharding-algorithm/)
+- [CREATE SHARDING
ALGORITHM](/en/reference/distsql/syntax/rdl/rule-definition/create-sharding-algorithm/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.cn.md
index 9c75f8fa2e7..cbfcce653c6 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.cn.md
@@ -9,7 +9,7 @@ weight = 2
### 语法定义
-```SQL
+```sql
CreateShardingAlgorithm ::=
'CREATE' 'SHARDING' 'ALGORITHM' shardingAlgorithmName '('
algorithmDefinition ')'
@@ -48,8 +48,8 @@ CREATE SHARDING ALGORITHM interval_algorithm (
### 保留字
- CREATE、SHARDING、ALGORITHM、TYPE、NAME、PROPERTIES
+`CREATE`、`SHARDING`、`ALGORITHM`、`TYPE`、`NAME`、`PROPERTIES`
### 相关链接
-- [保留字](/cn/reference/distsql/syntax/reserved-word/)
+- [保留字](/cn/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.en.md
index d57690092c3..5a6af61ccdd 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-algorithm.en.md
@@ -9,7 +9,7 @@ The `CREATE SHARDING ALGORITHM` syntax is used to create a
sharding algorithm fo
### Syntax
-```SQL
+```sql
CreateShardingAlgorithm ::=
'CREATE' 'SHARDING' 'ALGORITHM' shardingAlgorithmName '('
algorithmDefinition ')'
@@ -48,8 +48,7 @@ CREATE SHARDING ALGORITHM interval_algorithm (
### Reserved word
- CREATE、SHARDING、ALGORITHM、TYPE、NAME、PROPERTIES
+`CREATE`, `SHARDING`, `ALGORITHM`, `TYPE`, `NAME`, `PROPERTIES`
### Related links
- [Reserved word](/cn/reference/distsql/syntax/reserved-word/)
-
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.cn.md
index d52ee4114bc..74ce25c4e4c 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.cn.md
@@ -9,7 +9,7 @@ weight = 4
### 语法定义
-```SQL
+```sql
CreateBindingTableRule ::=
'CREATE' 'SHARDING' 'BINDING' 'TABLE' 'RULES' bindingRelationshipDefinition
(',' bindingRelationshipDefinition )*
@@ -25,8 +25,9 @@ tableName ::=
- 只有分片表才能创建绑定关系
- 一个分片表只能具有一个绑定关系
- 添加绑定关系的分片表需要使用相同的资源,并且分片节点个数相同。例如 `ds_${0..1}.t_order_${0..1}` 与
`ds_${0..1}.t_order_item_${0..1}`
-- 添加绑定关系的分片表需要对分片键使用相同的分片算法。例如 `t_order_${order_id % 2}` 与
`t_order_item_${order_item_id % 2}`
-- 只能存在一个绑定规则,但可包含多个绑定关系,因此无法重复执行 `CREATE SHARDING BINDING TABLE RULE`
。当绑定规则已经存在但还需要添加绑定关系时,需要使用 `ALTER SHARDING BINDING TABLE RULE` 来修改绑定规则
+- 添加绑定关系的分片表需要对分片键使用相同的分片算法。例如 `t_order_${order_id % 2}` 与
`t_order_item_${order_item_id % 2}`
+- 只能存在一个绑定规则,但可包含多个绑定关系,因此无法重复执行 `CREATE SHARDING BINDING TABLE RULE`。
+ 当绑定规则已经存在但还需要添加绑定关系时,需要使用 `ALTER SHARDING BINDING TABLE RULE` 来修改绑定规则
### 示例
@@ -45,5 +46,5 @@ CREATE SHARDING BINDING TABLE RULES
(t_order,t_order_item),(t_product,t_product_
```
### 相关链接
-- [CREATE SHARDING TABLE
RULE](/cn/reference/distsql/syntax/rdl/rule-definition/create-sharding-table-rule/)
+- [CREATE SHARDING TABLE
RULE](/cn/reference/distsql/syntax/rdl/rule-definition/create-sharding-table-rule/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.en.md
index d1061e96f09..993b7983244 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-binding-table-rule.en.md
@@ -5,11 +5,12 @@ weight = 4
## Description
-The `CREATE SHARDING BINDING TABLE RULE` syntax is used to add binding
relationships and create binding table rules for tables with sharding table
rules
+The `CREATE SHARDING BINDING TABLE RULE` syntax is used to add binding
relationships and create binding table rules for
+tables with sharding table rules
### Syntax
-```SQL
+```sql
CreateBindingTableRule ::=
'CREATE' 'SHARDING' 'BINDING' 'TABLE' 'RULES' bindingTableDefinition (','
bindingTableDefinition )*
@@ -24,9 +25,14 @@ tableName ::=
- Creating binding relationships rules can only use sharding tables
- A sharding table can only have one binding relationships
-- The sharding table for creating binding relationships needs to use the same
resources and the same actual tables. For example `ds_${0..1}.t_order_${0..1}`
与 `ds_${0..1}.t_order_item_${0..1}`
-- The sharding table for creating binding relationships needs to use the same
sharding algorithm for the sharding column. For example `t_order_{order_id %
2}` and `t_order_item_{order_item_id % 2}`
-- Only one binding rule can exist, but can contain multiple binding
relationships, so can not execute `CREATE SHARDING BINDING TABLE RULE` more
than one time. When a binding table rule already exists but a binding
relationship needs to be added, you need to use `ALTER SHARDING BINDING TABLE
RULE` to modify the binding table rule
+- The sharding table for creating binding relationships needs to use the same
resources and the same actual tables. For
+ example `ds_${0..1}.t_order_${0..1}` 与 `ds_${0..1}.t_order_item_${0..1}`
+- The sharding table for creating binding relationships needs to use the same
sharding algorithm for the sharding
+ column. For example `t_order_{order_id % 2}` and
`t_order_item_{order_item_id % 2}`
+- Only one binding rule can exist, but can contain multiple binding
relationships, so can not
+ execute `CREATE SHARDING BINDING TABLE RULE` more than one time. When a
binding table rule already exists but a
+ binding relationship needs to be added, you need to use `ALTER SHARDING
BINDING TABLE RULE` to modify the binding
+ table rule
### Example
@@ -45,5 +51,5 @@ CREATE SHARDING BINDING TABLE RULES
(t_order,t_order_item),(t_product,t_product_
```
### Related links
-- [CREATE SHARDING TABLE
RULE](/en/reference/distsql/syntax/rdl/rule-definition/create-sharding-table-rule/)
+- [CREATE SHARDING TABLE
RULE](/en/reference/distsql/syntax/rdl/rule-definition/create-sharding-table-rule/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.cn.md
index 9d8c3974171..185154cd9ef 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.cn.md
@@ -9,7 +9,7 @@ weight = 5
### 语法定义
-```SQL
+```sql
CreateDefaultShardingStrategy ::=
'CREATE' 'DEFAULT' 'SHARDING' ('DATABASE' | 'TABLE') 'STRATEGY' '('
shardingStrategy ')'
@@ -35,14 +35,22 @@ algorithmType ::=
### 补充说明
- `tableName` 可使用已经存在的表或者将要创建的表
-- 只能存在一个广播规则,但可包含多个广播表,因此无法重复执行 `CREATE SHARDING BROADCAST TABLE
RULE`。当广播规则已经存在但还需要添加广播表时,需要使用 `ALTER BROADCAST TABLE RULE` 来修改广播规则
+- 只能存在一个广播规则,但可包含多个广播表,因此无法重复执行 `CREATE SHARDING BROADCAST TABLE RULE`。
+ 当广播规则已经存在但还需要添加广播表时,需要使用 `ALTER BROADCAST TABLE RULE` 来修改广播规则
### 示例
#### 创建广播规则
-```SQL
+```sql
-- 将 t_province, t_city 添加到广播规则中
CREATE SHARDING BROADCAST TABLE RULES (t_province, t_city);
```
+### 保留字
+
+`CREATE`、`SHARDING`、`BROADCAST`、`TABLE`、`RULE`
+
+### 相关链接
+
+- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.en.md
index d305e23e538..f126525f273 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-broadcast-table-rule.en.md
@@ -5,11 +5,12 @@ weight = 5
## Description
-The `CREATE SHARDING BROADCAST TABLE RULE` syntax is used to create broadcast
table rules for tables that need to be broadcast (broadcast tables)
+The `CREATE SHARDING BROADCAST TABLE RULE` syntax is used to create broadcast
table rules for tables that need to be
+broadcast (broadcast tables)
### Syntax
-```SQL
+```sql
CreateBroadcastTableRule ::=
'CREATE' 'SHARDING' 'BROADCAST' 'TABLE' 'RULES' '(' tableName (','
tableName)* ')'
@@ -20,15 +21,23 @@ tableName ::=
### Supplement
- `tableName` can use an existing table or a table that will be created
-- Only one broadcast rule can exist, but can contain multiple broadcast
tables, so can not execute `CREATE SHARDING BROADCAST TABLE RULE` more than one
time. When the broadcast table rule already exists but the broadcast table
needs to be added, you need to use `ALTER BROADCAST TABLE RULE` to modify the
broadcast table rule
+- Only one broadcast rule can exist, but can contain multiple broadcast
tables, so can not
+ execute `CREATE SHARDING BROADCAST TABLE RULE` more than one time. When the
broadcast table rule already exists but
+ the broadcast table needs to be added, you need to use `ALTER BROADCAST
TABLE RULE` to modify the broadcast table rule
### Example
#### Create sharding broadcast table rule
-```SQL
+```sql
-- Add t_province, t_city to broadcast table rules
CREATE SHARDING BROADCAST TABLE RULES (t_province, t_city);
```
+### Reserved word
+`CREATE`, `SHARDING`, `BROADCAST`, `TABLE`, `RULE`
+
+### Related links
+
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.cn.md
index 994ca6a4250..b8b462e7bab 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.cn.md
@@ -9,7 +9,7 @@ weight = 6
### 语法定义
-```SQL
+```sql
CreateShardingAlgorithm ::=
'CREATE' 'SHARDING' 'KEY' 'GENERATOR' keyGeneratorName '('
algorithmDefinition ')'
@@ -28,13 +28,14 @@ algorithmType ::=
### 补充说明
-- `algorithmType`
为分布式主键生成算法类型,详细的分布式主键生成算法类型信息请参考[分布式序列算法类型](cn/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
+- `algorithmType`
+
为分布式主键生成算法类型,详细的分布式主键生成算法类型信息请参考[分布式序列算法类型](cn/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
### 示例
#### 创建分布式主键生成器
-```SQL
+```sql
CREATE SHARDING KEY GENERATOR snowflake_key_generator (
TYPE(NAME=SNOWFLAKE, PROPERTIES("max-vibration-offset"=3))
);
@@ -42,8 +43,8 @@ CREATE SHARDING KEY GENERATOR snowflake_key_generator (
### 保留字
- CREATE、SHARDING、KEY、GENERATOR、TYPE、NAME、PROPERTIES
+`CREATE`、`SHARDING`、`KEY`、`GENERATOR`、`TYPE`、`NAME`、`PROPERTIES`
### 相关链接
-- [保留字](/cn/reference/distsql/syntax/reserved-word/)
+- [保留字](/cn/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.en.md
index 3cd5fb220e8..6833380f927 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-key-generator.en.md
@@ -5,11 +5,12 @@ weight = 6
## Description
-The `CREATE SHARDING KEY GENERATOR` syntax is used to add a distributed
primary key generator for the currently selected logic database
+The `CREATE SHARDING KEY GENERATOR` syntax is used to add a distributed
primary key generator for the currently selected
+logic database
### Syntax
-```SQL
+```sql
CreateShardingAlgorithm ::=
'CREATE' 'SHARDING' 'KEY' 'GENERATOR' keyGeneratorName '('
algorithmDefinition ')'
@@ -28,13 +29,14 @@ algorithmType ::=
### Supplement
-- `algorithmType` is the key generate algorithm type. For detailed key
generate algorithm type information, please refer to [KEY GENERATE
ALGORITHM](en/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
+- `algorithmType` is the key generate algorithm type. For detailed key
generate algorithm type information, please refer
+ to [KEY GENERATE
ALGORITHM](en/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
### Example
#### Create a distributed primary key generator
-```SQL
+```sql
CREATE SHARDING KEY GENERATOR snowflake_key_generator (
TYPE(NAME=SNOWFLAKE, PROPERTIES("max-vibration-offset"=3))
);
@@ -42,8 +44,8 @@ CREATE SHARDING KEY GENERATOR snowflake_key_generator (
### Reserved word
- CREATE、SHARDING、KEY、GENERATOR、TYPE、NAME、PROPERTIES
+`CREATE`, `SHARDING`, `KEY`, `GENERATOR`, `TYPE`, `NAME`, `PROPERTIES`
### Related links
-- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.cn.md
index ef624d96836..6414cca6754 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.cn.md
@@ -9,7 +9,7 @@ weight = 2
### 语法定义
-```SQL
+```sql
CreateShardingTableRule ::=
'CREATE' 'SHARDING' 'TABLE' 'RULE' ( tableDefinition | autoTableDefinition )
( ',' ( tableDefinition | autoTableDefinition ) )*
@@ -46,18 +46,21 @@ algorithmName ::=
### 补充说明
-- `tableDefinition` 为标准分片规则定义;`autoTableDefinition`
为自动分片规则定义。标准分片规则和自动分片规则可参考[数据分片](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/)。
+- `tableDefinition` 为标准分片规则定义;`autoTableDefinition`
+
为自动分片规则定义。标准分片规则和自动分片规则可参考[数据分片](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/)。
- 当使用标准分片时:
- `DATANODES` 只能使用已经添加到当前逻辑库的资源,且只能使用 INLINE 表达式指定需要的资源
- `DATABASE_STRATEGY`、`TABLE_STRATEGY` 表示分库和分表策略,均为可选项,未配置时使用默认策略
- - `strategyDefinition` 中属性 `TYPE`
用于指定[分片算法](/cn/features/sharding/concept/sharding/#自定义分片算法)的类型,目前仅支持 `STANDARD`
、`COMPLEX`。使用 `COMPLEX` 时需要用 `SHARDING_COLUMNS` 指定多个分片键。
+ - `strategyDefinition` 中属性 `TYPE`
用于指定[分片算法](/cn/features/sharding/concept/sharding/#自定义分片算法)的类型,目前仅支持 `STANDARD`
+ 、`COMPLEX`。使用 `COMPLEX` 时需要用 `SHARDING_COLUMNS` 指定多个分片键。
- 当使用自动分片时:
- `RESOURCES` 只能使用已经添加到当前逻辑库的资源,可通过枚举或 INLINE 表达式指定需要的资源
-
只能使用自动分片算法,可参考[自动分片算法](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/#自动分片算法)
- `algorithmType`
为分片算法类型,分片算法类型请参考[分片算法](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/)
- 自动生成的算法命名规则为 `tableName` _ `strategyType` _ `algorithmType`
- 自动生成的主键策略命名规则为 `tableName` _ `strategyType`
-- `KEY_GENERATE_STRATEGY`
用于指定主键生成策略,为可选项,关于主键生成策略可参考[分布式主键](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
+- `KEY_GENERATE_STRATEGY`
+
用于指定主键生成策略,为可选项,关于主键生成策略可参考[分布式主键](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
### 示例
@@ -65,7 +68,7 @@ algorithmName ::=
- ##### 指定分片算法创建标准分片规则
-```SQL
+```sql
-- 创建分片算法
CREATE SHARDING ALGORITHM database_inline (
TYPE(NAME=inline, PROPERTIES("algorithm-expression"="t_order_${user_id %
2}"))
@@ -83,7 +86,7 @@ CREATE SHARDING TABLE RULE t_order (
- ##### 在默认分库策略下,通过指定分片算法创建标准分片规则
-```SQL
+```sql
-- 创建分片算法
CREATE SHARDING ALGORITHM database_inline (
TYPE(NAME=inline, PROPERTIES("algorithm-expression"="t_order_${user_id %
2}"))
@@ -105,7 +108,7 @@ CREATE SHARDING TABLE RULE t_order (
- ##### 在默认分库分表策略下,通过指定分片算法创建标准分片规则
-```SQL
+```sql
-- 创建分片算法
CREATE SHARDING ALGORITHM database_inline (
TYPE(NAME=inline, PROPERTIES("algorithm-expression"="t_order_${user_id %
2}"))
@@ -131,7 +134,7 @@ CREATE SHARDING TABLE RULE t_order (
- ##### 创建标准分片规则的同时创建分片算法
-```SQL
+```sql
CREATE SHARDING TABLE RULE t_order (
DATANODES("ds_${0..1}.t_order_${0..1}"),
DATABASE_STRATEGY(TYPE=standard, SHARDING_COLUMN=user_id,
SHARDING_ALGORITHM(TYPE(NAME=inline,
PROPERTIES("algorithm-expression"="ds_${user_id % 2}")))),
@@ -140,8 +143,10 @@ CREATE SHARDING TABLE RULE t_order (
```
#### 2.自动分片规则
+
- ##### 创建自动分片规则
-```SQL
+
+```sql
CREATE SHARDING TABLE RULE t_order (
RESOURCES(ds_0, ds_1),
SHARDING_COLUMN=order_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=4))
@@ -150,10 +155,10 @@ CREATE SHARDING TABLE RULE t_order (
### 保留字
-
CREATE、SHARDING、TABLE、RULE、DATANODES、DATABASE_STRATEGY、TABLE_STRATEGY、KEY_GENERATE_STRATEGY、RESOURCES、SHARDING_COLUMN、TYPE、SHARDING_COLUMN、KEY_GENERATOR、SHARDING_ALGORITHM、COLUMN、NAME、PROPERTIES
+`CREATE`、`SHARDING`、`TABLE`、`RULE`、`DATANODES`、`DATABASE_STRATEGY`、`TABLE_STRATEGY`、`KEY_GENERATE_STRATEGY`、`RESOURCES`、`SHARDING_COLUMN`、`TYPE`、`SHARDING_COLUMN`、`KEY_GENERATOR`、`SHARDING_ALGORITHM`、`COLUMN`、`NAME`、`PROPERTIES`
### 相关链接
+
- [保留字](/cn/reference/distsql/syntax/reserved-word/)
- [CREATE SHARDING
ALGORITHM](/cn/reference/distsql/syntax/rdl/rule-definition/create-sharding-algorithm/)
- [CREATE DEFAULT_SHARDING
STRATEGY](/cn/reference/distsql/syntax/rdl/rule-definition/create-default-sharding-strategy/)
-
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.en.md
index 7ef05036eab..c8301c7974a 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/sharding/create-sharding-table-rule.en.md
@@ -9,7 +9,7 @@ The `CREATE SHARDING TABLE RULE` syntax is used to add sharding
table rule for t
### Syntax
-```SQL
+```sql
CreateShardingTableRule ::=
'CREATE' 'SHARDING' 'TABLE' 'RULE' ( tableDefinition | autoTableDefinition )
( ',' ( tableDefinition | autoTableDefinition ) )*
@@ -46,18 +46,30 @@ algorithmName ::=
### Supplement
-- `tableDefinition` is defined for standard sharding table rule;
`autoTableDefinition` is defined for auto sharding table rule. For standard
sharding rules and auto sharding rule, refer to [Data
Sharding](en/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/).
+- `tableDefinition` is defined for standard sharding table rule;
`autoTableDefinition` is defined for auto sharding
+ table rule. For standard sharding rules and auto sharding rule, refer
+ to [Data
Sharding](en/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/).
- use standard sharding table rule
- - `DATANODES` can only use resources that have been added to the current
database, and can only use INLINE expressions to specify required resources
- - `DATABASE_STRATEGY`, `TABLE_STRATEGY` are the database sharding strategy
and the table sharding strategy, which are optional, and the default strategy
is used when not configured
- - The attribute `TYPE` in `strategyDefinition` is used to specify the type
of [Sharding
Algorithm](/en/features/sharding/concept/sharding/#user-defined-sharding-algorithm),
currently only supports `STANDARD`, `COMPLEX`. Using `COMPLEX` requires
specifying multiple sharding columns with `SHARDING_COLUMNS`.
+ - `DATANODES` can only use resources that have been added to the current
database, and can only use INLINE
+ expressions to specify required resources
+ - `DATABASE_STRATEGY`, `TABLE_STRATEGY` are the database sharding strategy
and the table sharding strategy, which
+ are optional, and the default strategy is used when not configured
+ - The attribute `TYPE` in `strategyDefinition` is used to specify the type
+ of [Sharding
Algorithm](/en/features/sharding/concept/sharding/#user-defined-sharding-algorithm),
currently only
+ supports `STANDARD`, `COMPLEX`. Using `COMPLEX` requires specifying
multiple sharding columns
+ with `SHARDING_COLUMNS`.
- use auto sharding table rule
- - `RESOURCES` can only use resources that have been added to the current
database, and the required resources can be specified by enumeration or INLINE
expression
- - Only auto sharding algorithm can be used, please refer to [Auto Sharding
Algorithm](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/#auto-sharding-algorithm)
-- `algorithmType` is the sharding algorithm type, please refer to [Sharding
Algorithm](en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding)
+ - `RESOURCES` can only use resources that have been added to the current
database, and the required resources can be
+ specified by enumeration or INLINE expression
+ - Only auto sharding algorithm can be used, please refer
+ to [Auto Sharding
Algorithm](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/#auto-sharding-algorithm)
+- `algorithmType` is the sharding algorithm type, please refer
+ to [Sharding
Algorithm](en/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding)
- The auto-generated algorithm naming rule is `tableName` _ `strategyType` _
`shardingAlgorithmType`
- The auto-generated primary key strategy naming rule is `tableName` _
`strategyType`
-- `KEY_GENERATE_STRATEGY` is used to specify the primary key generation
strategy, which is optional. For the primary key generation strategy, please
refer to [Distributed Primary
Key](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
+- `KEY_GENERATE_STRATEGY` is used to specify the primary key generation
strategy, which is optional. For the primary key
+ generation strategy, please refer
+ to [Distributed Primary
Key](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/keygen/)
### Example
@@ -82,7 +94,8 @@ CREATE SHARDING TABLE RULE t_order (
```
- ##### Use the default sharding database strategy, create standard sharding
table rule by specifying a sharding algorithm
-```SQL
+
+```sql
-- create sharding algorithms
CREATE SHARDING ALGORITHM database_inline (
TYPE(NAME=inline, PROPERTIES("algorithm-expression"="t_order_${user_id %
2}"))
@@ -130,7 +143,7 @@ CREATE SHARDING TABLE RULE t_order (
- ##### Create standard sharding table rule and sharding algorithms at the
same time
-```SQL
+```sql
CREATE SHARDING TABLE RULE t_order (
DATANODES("ds_${0..1}.t_order_${0..1}"),
DATABASE_STRATEGY(TYPE=standard, SHARDING_COLUMN=user_id,
SHARDING_ALGORITHM(TYPE(NAME=inline,
PROPERTIES("algorithm-expression"="ds_${user_id % 2}")))),
@@ -139,8 +152,10 @@ CREATE SHARDING TABLE RULE t_order (
```
#### 2.Auto sharding table rule
+
- ##### create auto sharding table rule
-```SQL
+
+```sql
CREATE SHARDING TABLE RULE t_order (
RESOURCES(ds_0, ds_1),
SHARDING_COLUMN=order_id, TYPE(NAME=MOD, PROPERTIES("sharding-count"=4))
@@ -149,9 +164,10 @@ CREATE SHARDING TABLE RULE t_order (
### Reserved word
- CREATE, SHARDING, TABLE, RULE, DATANODES, DATABASE_STRATEGY,
TABLE_STRATEGY, KEY_GENERATE_STRATEGY, RESOURCES, SHARDING_COLUMN, TYPE,
SHARDING_COLUMN, KEY_GENERATOR, SHARDING_ALGORITHM, COLUMN, NAME, PROPERTIES
+`CREATE`, `SHARDING`, `TABLE`, `RULE`, `DATANODES`, `DATABASE_STRATEGY`,
`TABLE_STRATEGY`, `KEY_GENERATE_STRATEGY`, `RESOURCES`, `SHARDING_COLUMN`,
`TYPE`, `SHARDING_COLUMN`, `KEY_GENERATOR`, `SHARDING_ALGORITHM`, `COLUMN`,
`NAME`, `PROPERTIES`
### Related links
+
- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
- [CREATE SHARDING
ALGORITHM](/en/reference/distsql/syntax/rdl/rule-definition/create-sharding-algorithm/)
- [CREATE DEFAULT_SHARDING
STRATEGY](/en/reference/distsql/syntax/rdl/rule-definition/create-default-sharding-strategy/)