This is an automated email from the ASF dual-hosted git repository.
wanghailin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 825caa8dec [Improve][API] Add IGNORE savemode type (#7443)
825caa8dec is described below
commit 825caa8dec7faf51cbbf95937c0e0e6a4ca912d8
Author: jw-itq <[email protected]>
AuthorDate: Thu Aug 22 21:04:53 2024 +0800
[Improve][API] Add IGNORE savemode type (#7443)
---
docs/en/connector-v2/sink/Doris.md | 3 ++-
docs/en/connector-v2/sink/Elasticsearch.md | 13 +++++++------
docs/en/connector-v2/sink/Jdbc.md | 3 ++-
docs/en/connector-v2/sink/LocalFile.md | 1 +
docs/en/connector-v2/sink/PostgreSql.md | 3 ++-
docs/en/connector-v2/sink/S3File.md | 3 ++-
docs/en/connector-v2/sink/StarRocks.md | 3 ++-
docs/zh/connector-v2/sink/Doris.md | 15 ++++++++-------
docs/zh/connector-v2/sink/Elasticsearch.md | 1 +
docs/zh/connector-v2/sink/Jdbc.md | 1 +
docs/zh/connector-v2/sink/StarRocks.md | 9 +++++----
.../apache/seatunnel/api/sink/DefaultSaveModeHandler.java | 2 ++
.../org/apache/seatunnel/api/sink/SchemaSaveMode.java | 3 +++
13 files changed, 38 insertions(+), 22 deletions(-)
diff --git a/docs/en/connector-v2/sink/Doris.md
b/docs/en/connector-v2/sink/Doris.md
index 592cd8702b..18915ac7b8 100644
--- a/docs/en/connector-v2/sink/Doris.md
+++ b/docs/en/connector-v2/sink/Doris.md
@@ -57,7 +57,8 @@ Before the synchronous task is turned on, different treatment
schemes are select
Option introduction:
`RECREATE_SCHEMA` :Will create when the table does not exist, delete and
rebuild when the table is saved
`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the table does not exist,
skipped when the table is saved
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode[Enum]
diff --git a/docs/en/connector-v2/sink/Elasticsearch.md
b/docs/en/connector-v2/sink/Elasticsearch.md
index e03a252230..b252f574da 100644
--- a/docs/en/connector-v2/sink/Elasticsearch.md
+++ b/docs/en/connector-v2/sink/Elasticsearch.md
@@ -109,17 +109,18 @@ Sink plugin common parameters, please refer to [Sink
Common Options](../sink-com
Before the synchronous task is turned on, different treatment schemes are
selected for the existing surface structure of the target side.
Option introduction:
-RECREATE_SCHEMA :Will create when the table does not exist, delete and rebuild
when the table is saved
-CREATE_SCHEMA_WHEN_NOT_EXIST :Will Created when the table does not exist,
skipped when the table is saved
-ERROR_WHEN_SCHEMA_NOT_EXIST :Error will be reported when the table does not
exist
+`RECREATE_SCHEMA` :Will create when the table does not exist, delete and
rebuild when the table is saved
+`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the table does not exist,
skipped when the table is saved
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode
Before the synchronous task is turned on, different processing schemes are
selected for data existing data on the target side.
Option introduction:
-DROP_DATA: Preserve database structure and delete data
-APPEND_DATA:Preserve database structure, preserve data
-ERROR_WHEN_DATA_EXISTS:When there is data, an error is reported
+`DROP_DATA`: Preserve database structure and delete data
+`APPEND_DATA`:Preserve database structure, preserve data
+`ERROR_WHEN_DATA_EXISTS`:When there is data, an error is reported
## Examples
diff --git a/docs/en/connector-v2/sink/Jdbc.md
b/docs/en/connector-v2/sink/Jdbc.md
index b52c42f631..99f06891a1 100644
--- a/docs/en/connector-v2/sink/Jdbc.md
+++ b/docs/en/connector-v2/sink/Jdbc.md
@@ -183,7 +183,8 @@ Before the synchronous task is turned on, different
treatment schemes are select
Option introduction:
`RECREATE_SCHEMA` :Will create when the table does not exist, delete and
rebuild when the table is saved
`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the table does not exist,
skipped when the table is saved
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode [Enum]
diff --git a/docs/en/connector-v2/sink/LocalFile.md
b/docs/en/connector-v2/sink/LocalFile.md
index b1746e2492..8e773fe6dd 100644
--- a/docs/en/connector-v2/sink/LocalFile.md
+++ b/docs/en/connector-v2/sink/LocalFile.md
@@ -214,6 +214,7 @@ Existing dir processing method.
- RECREATE_SCHEMA: will create when the dir does not exist, delete and
recreate when the dir is exist
- CREATE_SCHEMA_WHEN_NOT_EXIST: will create when the dir does not exist,
skipped when the dir is exist
- ERROR_WHEN_SCHEMA_NOT_EXIST: error will be reported when the dir does not
exist
+- IGNORE :Ignore the treatment of the table
### data_save_mode [string]
diff --git a/docs/en/connector-v2/sink/PostgreSql.md
b/docs/en/connector-v2/sink/PostgreSql.md
index 545f0d176e..cde299f673 100644
--- a/docs/en/connector-v2/sink/PostgreSql.md
+++ b/docs/en/connector-v2/sink/PostgreSql.md
@@ -118,7 +118,8 @@ Before the synchronous task is turned on, different
treatment schemes are select
Option introduction:
`RECREATE_SCHEMA` :Will create when the table does not exist, delete and
rebuild when the table is saved
`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the table does not exist,
skipped when the table is saved
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode[Enum]
diff --git a/docs/en/connector-v2/sink/S3File.md
b/docs/en/connector-v2/sink/S3File.md
index 90fb663646..007c9395f7 100644
--- a/docs/en/connector-v2/sink/S3File.md
+++ b/docs/en/connector-v2/sink/S3File.md
@@ -281,7 +281,8 @@ Before turning on the synchronous task, do different
treatment of the target pat
Option introduction:
`RECREATE_SCHEMA` :Will be created when the path does not exist. If the path
already exists, delete the path and recreate it.
`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the path does not exist, use
the path when the path is existed.
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the path does not
exist
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the path does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode[Enum]
diff --git a/docs/en/connector-v2/sink/StarRocks.md
b/docs/en/connector-v2/sink/StarRocks.md
index 5fe57cd3f4..1d143884e6 100644
--- a/docs/en/connector-v2/sink/StarRocks.md
+++ b/docs/en/connector-v2/sink/StarRocks.md
@@ -107,7 +107,8 @@ Before the synchronous task is turned on, different
treatment schemes are select
Option introduction:
`RECREATE_SCHEMA` :Will create when the table does not exist, delete and
rebuild when the table is saved
`CREATE_SCHEMA_WHEN_NOT_EXIST` :Will Created when the table does not exist,
skipped when the table is saved
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :Error will be reported when the table does not
exist
+`IGNORE` :Ignore the treatment of the table
### data_save_mode[Enum]
diff --git a/docs/zh/connector-v2/sink/Doris.md
b/docs/zh/connector-v2/sink/Doris.md
index afc470326f..b35cd63f4e 100644
--- a/docs/zh/connector-v2/sink/Doris.md
+++ b/docs/zh/connector-v2/sink/Doris.md
@@ -53,18 +53,19 @@ Doris Sink连接器的内部实现是通过stream load批量缓存和导入的
### schema_save_mode[Enum]
在开启同步任务之前,针对现有的表结构选择不同的处理方案。
-选项介绍:
+选项介绍:
`RECREATE_SCHEMA` :表不存在时创建,表保存时删除并重建。
-`CREATE_SCHEMA_WHEN_NOT_EXIST` :表不存在时会创建,表存在时跳过。
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :表不存在时会报错。
+`CREATE_SCHEMA_WHEN_NOT_EXIST` :表不存在时会创建,表存在时跳过。
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :表不存在时会报错。
+`IGNORE` :忽略对表的处理。
### data_save_mode[Enum]
在开启同步任务之前,针对目标端已有的数据选择不同的处理方案。
-选项介绍:
-`DROP_DATA`: 保留数据库结构并删除数据。
-`APPEND_DATA`:保留数据库结构,保留数据。
-`CUSTOM_PROCESSING`:用户自定义处理。
+选项介绍:
+`DROP_DATA`: 保留数据库结构并删除数据。
+`APPEND_DATA`:保留数据库结构,保留数据。
+`CUSTOM_PROCESSING`:用户自定义处理。
`ERROR_WHEN_DATA_EXISTS`:有数据时报错。
### save_mode_create_template
diff --git a/docs/zh/connector-v2/sink/Elasticsearch.md
b/docs/zh/connector-v2/sink/Elasticsearch.md
index 2d614918f9..8682d26227 100644
--- a/docs/zh/connector-v2/sink/Elasticsearch.md
+++ b/docs/zh/connector-v2/sink/Elasticsearch.md
@@ -111,6 +111,7 @@ Sink插件常用参数,请参考 [Sink常用选项](../sink-common-options.md)
`RECREATE_SCHEMA` :当表不存在时会创建,当表已存在时会删除并重建<br/>
`CREATE_SCHEMA_WHEN_NOT_EXIST` :当表不存在时会创建,当表已存在时则跳过创建<br/>
`ERROR_WHEN_SCHEMA_NOT_EXIST` :当表不存在时将抛出错误<br/>
+`IGNORE` :忽略对表的处理<br/>
### data_save_mode
diff --git a/docs/zh/connector-v2/sink/Jdbc.md
b/docs/zh/connector-v2/sink/Jdbc.md
index f24e56f1f7..b05ecbc501 100644
--- a/docs/zh/connector-v2/sink/Jdbc.md
+++ b/docs/zh/connector-v2/sink/Jdbc.md
@@ -178,6 +178,7 @@ Sink插件常用参数,请参考 [Sink常用选项](../sink-common-options.md)
`RECREATE_SCHEMA`:当表不存在时会创建,当表已存在时会删除并重建<br/>
`CREATE_SCHEMA_WHEN_NOT_EXIST`:当表不存在时会创建,当表已存在时则跳过创建<br/>
`ERROR_WHEN_SCHEMA_NOT_EXIST`:当表不存在时将抛出错误<br/>
+`IGNORE` :忽略对表的处理<br/>
### data_save_mode [Enum]
diff --git a/docs/zh/connector-v2/sink/StarRocks.md
b/docs/zh/connector-v2/sink/StarRocks.md
index 6be7ff7e8e..f5848a3b71 100644
--- a/docs/zh/connector-v2/sink/StarRocks.md
+++ b/docs/zh/connector-v2/sink/StarRocks.md
@@ -99,10 +99,11 @@ table选项参数可以填入一任意表名,这个名字最终会被用作目
### schema_save_mode[Enum]
-在同步任务打开之前,针对目标端已存在的表结构选择不同的处理方法。可选值有:
-`RECREATE_SCHEMA` :不存在的表会直接创建,已存在的表会删除并根据参数重新创建
-`CREATE_SCHEMA_WHEN_NOT_EXIST` :忽略已存在的表,不存在的表会直接创建
-`ERROR_WHEN_SCHEMA_NOT_EXIST` :当有不存在的表时会直接报错
+在同步任务打开之前,针对目标端已存在的表结构选择不同的处理方法。可选值有:
+`RECREATE_SCHEMA` :不存在的表会直接创建,已存在的表会删除并根据参数重新创建
+`CREATE_SCHEMA_WHEN_NOT_EXIST` :忽略已存在的表,不存在的表会直接创建
+`ERROR_WHEN_SCHEMA_NOT_EXIST` :当有不存在的表时会直接报错
+`IGNORE` :忽略对表的处理
### data_save_mode[Enum]
diff --git
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DefaultSaveModeHandler.java
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DefaultSaveModeHandler.java
index fc07b99000..269b318159 100644
---
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DefaultSaveModeHandler.java
+++
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/DefaultSaveModeHandler.java
@@ -76,6 +76,8 @@ public class DefaultSaveModeHandler implements
SaveModeHandler {
case ERROR_WHEN_SCHEMA_NOT_EXIST:
errorWhenSchemaNotExist();
break;
+ case IGNORE:
+ break;
default:
throw new UnsupportedOperationException("Unsupported save
mode: " + schemaSaveMode);
}
diff --git
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaSaveMode.java
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaSaveMode.java
index f3da320d74..cee39ca8e6 100644
---
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaSaveMode.java
+++
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SchemaSaveMode.java
@@ -27,4 +27,7 @@ public enum SchemaSaveMode {
// Error will be reported when the table does not exist
ERROR_WHEN_SCHEMA_NOT_EXIST,
+
+ // Ignore creation
+ IGNORE
}