You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/04/14 10:56:13 UTC

[shardingsphere] branch master updated: Refactor `DROP RESOURCE` syntax doc (#16761)

This is an automated email from the ASF dual-hosted git repository.

jianglongtao 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 46f87ffd84a Refactor `DROP RESOURCE` syntax doc (#16761)
46f87ffd84a is described below

commit 46f87ffd84a1dcd4e9e19c583139fd39f3246d28
Author: lanchengx <52...@users.noreply.github.com>
AuthorDate: Thu Apr 14 18:56:06 2022 +0800

    Refactor `DROP RESOURCE` syntax doc (#16761)
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
    
    * DistSQL Documentation.
---
 .../rdl/resource-definition/drop-resource.cn.md    | 48 ++++++++++++++++++++++
 .../rdl/resource-definition/drop-resource.en.md    | 47 +++++++++++++++++++++
 2 files changed, 95 insertions(+)

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
new file mode 100644
index 00000000000..919cdb3be54
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.cn.md
@@ -0,0 +1,48 @@
++++
+title = "DROP RESOURCE"
+weight = 3
++++
+
+### 描述
+
+`DROP RESOURCE` 语法用于从当前逻辑库中移除资源。 
+
+### 语法
+```SQL
+DropResource ::=
+  'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName  ( ',' dataSourceName )* ( 'IGNORE' 'SINGLE' 'TABLES' )?
+```
+
+ ### 补充说明
+
+- `DROP RESOURCE` 只会移除 Proxy 中的资源,不会删除与资源对应的真实数据源
+- 无法移除已经被规则使用的资源。移除被规则使用的资源时会提示 `Resources are still in used.` 
+- 将要移除的资源中仅包含 `SINGLE TABLE RULE`,且用户确认可以忽略该限制时,可添加 `IGNORE SINGLE TABLES` 关键字移除资源
+
+ ### 示例
+- 移除资源
+```SQL
+DROP RESOURCE ds_0;
+```
+
+- 移除多个资源
+```SQL
+DROP RESOURCE ds_1, ds_2;
+```
+
+- 忽略单表移除资源
+```SQL
+DROP RESOURCE ds_3 IGNORE SINGLE TABLES;
+```
+
+- 如果资源存在则移除
+```SQL
+DROP RESOURCE IF EXISTS ds_4;
+```
+
+### 保留字
+
+    DROP、 RESOURCE、 IF、 EXISTS、 IGNORE、 SINGLE、 TABLES
+
+ ### 相关链接
+- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
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
new file mode 100644
index 00000000000..51f42fc8272
--- /dev/null
+++ b/docs/document/content/reference/distsql/syntax/rdl/resource-definition/drop-resource.en.md
@@ -0,0 +1,47 @@
++++
+title = "DROP RESOURCE"
+weight = 3
++++
+
+### Description
+
+The `DROP RESOURCE` syntax is used to drop resources from the current schema
+
+### Syntax
+```SQL
+DropResource ::=
+  'DROP' 'RESOURCE' ( 'IF' 'EXISTS' )? dataSourceName  ( ',' dataSourceName )* ( 'IGNORE' 'SINGLE' 'TABLES' )?
+```
+
+### Supplement
+
+- `DROP RESOURCE` will only drop resources in Proxy, the real data source corresponding to the resource will not be dropped
+- Unable to drop resources already used by rules. `Resources are still in used.` will be prompted when removing resources used by rules
+- The resource need to be removed only contains `SINGLE TABLE RULE`, and when the user confirms that this restriction can be ignored, the `IGNORE SINGLE TABLES` keyword can be added to remove the resource
+### Example
+- Drop a resource
+```SQL
+DROP RESOURCE ds_0;
+```
+
+- Drop multiple resources
+```SQL
+DROP RESOURCE ds_1, ds_2;
+```
+
+- Ignore single table rule remove resource
+```SQL
+DROP RESOURCE ds_1 IGNORE SINGLE TABLES;
+```
+
+- Drop the resource if it exists
+```SQL
+DROP RESOURCE IF EXISTS ds_2;
+```
+
+### Reserved word
+
+    DROP、 RESOURCE、 IF、 EXISTS、 IGNORE、 SINGLE、 TABLES
+
+### Related links
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
\ No newline at end of file