You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2021/12/16 02:39:08 UTC
[incubator-doris] branch master updated: [docs](sql-block-rule) modify document of sql block rule (#7370)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 2e334d0 [docs](sql-block-rule) modify document of sql block rule (#7370)
2e334d0 is described below
commit 2e334d06daac2b51ed2d575d6ad77efc8731b4dc
Author: jiafeng.zhang <zh...@gmail.com>
AuthorDate: Thu Dec 16 10:38:54 2021 +0800
[docs](sql-block-rule) modify document of sql block rule (#7370)
---
.../en/administrator-guide/block-rule/sql-block.md | 24 ++++++++++++++++------
.../administrator-guide/block-rule/sql-block.md | 24 ++++++++++++++++------
2 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/docs/en/administrator-guide/block-rule/sql-block.md b/docs/en/administrator-guide/block-rule/sql-block.md
index ddbd1e5..569e90e 100644
--- a/docs/en/administrator-guide/block-rule/sql-block.md
+++ b/docs/en/administrator-guide/block-rule/sql-block.md
@@ -33,27 +33,39 @@ Support SQL block rule by user level, by regex way to deny specify SQL
SQL block rule CRUD
- create SQL block rule
- sql:Regex pattern,Special characters need to be translated
- - sqlHash: Sql hash value, Used to match exactly, We print it in fe.audit.log
+ - sqlHash: Sql hash value, Used to match exactly, We print it in fe.audit.log,This parameter is the only choice between sql and sql, If you give a null value, it is an empty string not null
- global: Whether global(all users)is in effect, false by default
- enable:Whether to enable block rule,true by default
+```sql
+CREATE SQL_BLOCK_RULE test_rule
+PROPERTIES(
+ "sql"="select * from order_analysis",
+ "global"="false",
+ "enable"="true",
+ "sqlHash"=""
+)
```
-CREATE SQL_BLOCK_RULE test_rule PROPERTIES("sql"="select \\* from test_table","sqlHash":null,"global"="false","enable"="true")
+When we execute the sql that we defined in the rule just now, an exception error will be returned. An example is as follows:
+```sql
+mysql> select * from order_analysis;
+ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule
```
- show configured SQL block rules, or show all rules if you do not specify a rule name
-```
+
+```sql
SHOW SQL_BLOCK_RULE [FOR RULE_NAME]
```
- alter SQL block rule,Allows changes sql/global/enable anyone
-```
+```sql
ALTER SQL_BLOCK_RULE test_rule PROPERTIES("sql"="select \\* from test_table","enable"="true")
```
- drop SQL block rule,Support multiple rules, separated by `,`
-```
+```sql
DROP SQL_BLOCK_RULE test_rule1,test_rule2
```
## User bind rules
If global=false is configured, the rules binding for the specified user needs to be configured, with multiple rules separated by ', '
-```
+```sql
SET PROPERTY [FOR 'jack'] 'sql_block_rules' = 'test_rule1,test_rule2'
```
diff --git a/docs/zh-CN/administrator-guide/block-rule/sql-block.md b/docs/zh-CN/administrator-guide/block-rule/sql-block.md
index bfaa167..ad44109 100644
--- a/docs/zh-CN/administrator-guide/block-rule/sql-block.md
+++ b/docs/zh-CN/administrator-guide/block-rule/sql-block.md
@@ -33,19 +33,31 @@ under the License.
对SQL规则增删改查
- 创建SQL阻止规则
- sql:匹配规则(基于正则匹配,特殊字符需要转译),可选
- - sqlHash: sql hash值,用于完全匹配,我们会在`fe.audit.log`打印这个值,可选
+ - sqlHash: sql hash值,用于完全匹配,我们会在`fe.audit.log`打印这个值,可选,这个参数和sql只能二选一,如果给空值,是空字符串不是null
- global:是否全局(所有用户)生效,默认为false
- enable:是否开启阻止规则,默认为true
+```sql
+CREATE SQL_BLOCK_RULE test_rule
+PROPERTIES(
+ "sql"="select * from order_analysis",
+ "global":"false",
+ "enable"="true",
+ "sqlHash"=""
+)
```
-CREATE SQL_BLOCK_RULE test_rule PROPERTIES("sql"="select \\* from test_table","sqlHash":null,"enable"="true")
+当我们去执行刚才我们定义在规则里的sql时就会返回异常错误,示例如下:
+```sql
+mysql> select * from order_analysis;
+ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule
```
- 查看已配置的SQL阻止规则,不指定规则名则为查看所有规则
-```
+
+```sql
SHOW SQL_BLOCK_RULE [FOR RULE_NAME]
```
- 修改SQL阻止规则,允许对sql/global/enable等每一项进行修改
-```
-ALTER SQL_BLOCK_RULE test_rule PROPERTIES("sql"="select \\* from test_table","enable"="true")
+```sql
+ALTER SQL_BLOCK_RULE test_rule PROPERTIES("sql"="select * from order_analysis","enable"="true")
```
- 删除SQL阻止规则,支持多规则,以`,`隔开
```
@@ -54,6 +66,6 @@ DROP SQL_BLOCK_RULE test_rule1,test_rule2
## 用户规则绑定
如果配置global=false,则需要配置指定用户的规则绑定,多个规则使用`,`分隔
-```
+```sql
SET PROPERTY [FOR 'jack'] 'sql_block_rules' = 'test_rule1,test_rule2'
```
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org