You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2023/04/26 05:41:21 UTC

[doris] branch master updated: [doc](update-key)add update key doc (#18899)

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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ca19b972cc [doc](update-key)add update key doc (#18899)
ca19b972cc is described below

commit ca19b972cc40217ba00065312b5c0d2130cd13ba
Author: wudi <67...@qq.com>
AuthorDate: Wed Apr 26 13:41:14 2023 +0800

    [doc](update-key)add update key doc (#18899)
---
 docs/en/docs/data-operate/update-delete/update.md           |  3 +++
 docs/en/docs/ecosystem/flink-doris-connector.md             | 10 ++++++++++
 .../Data-Manipulation-Statements/Manipulation/UPDATE.md     |  1 +
 docs/zh-CN/docs/data-operate/update-delete/update.md        |  3 +++
 docs/zh-CN/docs/ecosystem/flink-doris-connector.md          | 13 +++++++++++++
 .../Data-Manipulation-Statements/Manipulation/UPDATE.md     |  2 ++
 6 files changed, 32 insertions(+)

diff --git a/docs/en/docs/data-operate/update-delete/update.md b/docs/en/docs/data-operate/update-delete/update.md
index 149d4ea013..a47415fed3 100644
--- a/docs/en/docs/data-operate/update-delete/update.md
+++ b/docs/en/docs/data-operate/update-delete/update.md
@@ -124,6 +124,9 @@ Since the table order is a UNIQUE model, the rows with the same Key, after which
   |---|---|---| 
   | 1 | 100 | Pending shipments |
 
+## Update primary key column
+Currently, the Update operation only supports updating the Value column, and the update of the Key column can refer to [Using FlinkCDC to update key column](../../ecosystem/flink-doris-connector.md#Use-FlinkCDC-to-update-Key-column)
+
 ## More Help
 
 For more detailed syntax used by **data update**, please refer to the [update](../../sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md) command manual , you can also enter `HELP UPDATE` in the Mysql client command line to get more help information.
diff --git a/docs/en/docs/ecosystem/flink-doris-connector.md b/docs/en/docs/ecosystem/flink-doris-connector.md
index c57d757491..82be9f8bfe 100644
--- a/docs/en/docs/ecosystem/flink-doris-connector.md
+++ b/docs/en/docs/ecosystem/flink-doris-connector.md
@@ -441,6 +441,16 @@ WITH (
 insert into doris_sink select id,name from cdc_mysql_source;
 ```
 
+## Use FlinkCDC to update Key column
+Generally, in a business database, the number is used as the primary key of the table, such as the Student table, the number (id) is used as the primary key, but with the development of the business, the number corresponding to the data may change.
+In this scenario, using FlinkCDC + Doris Connector to synchronize data can automatically update the data in the Doris primary key column.
+### Principle
+The underlying collection tool of Flink CDC is Debezium. Debezium internally uses the op field to identify the corresponding operation: the values of the op field are c, u, d, and r, corresponding to create, update, delete, and read.
+For the update of the primary key column, FlinkCDC will send DELETE and INSERT events downstream, and after the data is synchronized to Doris, it will automatically update the data of the primary key column.
+
+### Example
+The Flink program can refer to the CDC synchronization example above. After the task is successfully submitted, execute the Update primary key column statement (`update student set id = '1002' where id = '1001'`) on the MySQL side to modify the data in Doris .
+
 ## Java example
 
 `samples/doris-demo/`  An example of the Java version is provided below for reference, see [here](https://github.com/apache/doris/tree/master/samples/doris-demo/)
diff --git a/docs/en/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md b/docs/en/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
index 24d52aeaab..050e59d393 100644
--- a/docs/en/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
+++ b/docs/en/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
@@ -34,6 +34,7 @@ UPDATE
 
 This statement is used to update the data. The UPDATE statement currently only supports the UNIQUE KEY model.
 
+The UPDATE operation currently only supports updating the Value column. The update of the Key column can refer to [Using FlinkCDC to update Key column](../../../../ecosystem/flink-doris-connector.md#use-flinkcdc-to-update-key-column).
 #### Syntax
 
 ```sql
diff --git a/docs/zh-CN/docs/data-operate/update-delete/update.md b/docs/zh-CN/docs/data-operate/update-delete/update.md
index 3e7a610765..232a10caff 100644
--- a/docs/zh-CN/docs/data-operate/update-delete/update.md
+++ b/docs/zh-CN/docs/data-operate/update-delete/update.md
@@ -121,6 +121,9 @@ Query OK, 1 row affected (0.11 sec)
   |---|---|---| 
   | 1 | 100 | 待发货 |
 
+## 更新Key列
+目前Update操作只支持更新Value列,Key列的更新可参考[使用FlinkCDC更新Key列](../../ecosystem/flink-doris-connector.md#使用FlinkCDC更新Key列)
+
 ## 更多帮助
 
 关于 **数据更新** 使用的更多详细语法,请参阅 [update](../../sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md) 命令手册,也可以在Mysql客户端命令行下输入 `HELP UPDATE` 获取更多帮助信息。
diff --git a/docs/zh-CN/docs/ecosystem/flink-doris-connector.md b/docs/zh-CN/docs/ecosystem/flink-doris-connector.md
index c137dcba07..4dbb3b8ff2 100644
--- a/docs/zh-CN/docs/ecosystem/flink-doris-connector.md
+++ b/docs/zh-CN/docs/ecosystem/flink-doris-connector.md
@@ -399,6 +399,9 @@ env.fromSource(mySqlSource, WatermarkStrategy.noWatermarks(), "MySQL Source")//.
 
 ## 使用 Flink CDC 接入 Doris 示例(支持 Insert / Update / Delete 事件)
 ```sql
+-- enable checkpoint
+SET 'execution.checkpointing.interval' = '10s';
+
 CREATE TABLE cdc_mysql_source (
   id int
   ,name VARCHAR
@@ -433,6 +436,16 @@ WITH (
 insert into doris_sink select id,name from cdc_mysql_source;
 ```
 
+## 使用FlinkCDC更新Key列
+一般在业务数据库中,会使用编号来作为表的主键,比如Student表,会使用编号(id)来作为主键,但是随着业务的发展,数据对应的编号有可能是会发生变化的。
+在这种场景下,使用FlinkCDC + Doris Connector同步数据,便可以自动更新Doris主键列的数据。
+### 原理
+Flink CDC底层的采集工具是Debezium,Debezium内部使用op字段来标识对应的操作:op字段的取值分别为c、u、d、r,分别对应create、update、delete和read。
+而对于主键列的更新,FlinkCDC会向下游发送DELETE和INSERT事件,同时数据同步到Doris中后,就会自动更新主键列的数据。
+
+### 使用
+Flink程序可参考上面CDC同步的示例,成功提交任务后,在MySQL侧执行Update主键列的语句(`update  student set id = '1002' where id = '1001'`),即可修改Doris中的数据。
+
 ## Java示例
 
 `samples/doris-demo/` 下提供了 Java 版本的示例,可供参考,查看点击[这里](https://github.com/apache/doris/tree/master/samples/doris-demo/)
diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
index 9bcbfa868b..065622dc38 100644
--- a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
+++ b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Manipulation-Statements/Manipulation/UPDATE.md
@@ -34,6 +34,8 @@ UPDATE
 
 该语句是为进行对数据进行更新的操作,UPDATE 语句目前仅支持 UNIQUE KEY 模型。
 
+UPDATE操作目前只支持更新Value列,Key列的更新可参考[使用FlinkCDC更新Key列](../../../../ecosystem/flink-doris-connector.md#使用flinkcdc更新key列)。
+
 #### Syntax
 
 ```sql


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org