You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "Hisoka-X (via GitHub)" <gi...@apache.org> on 2025/01/06 03:58:34 UTC

Re: [PR] [Improve][Connector-V2] Support dynamic write mode for JDBC Sink [seatunnel]

Hisoka-X commented on code in PR #8305:
URL: https://github.com/apache/seatunnel/pull/8305#discussion_r1903624414


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/config/JdbcSinkConfig.java:
##########
@@ -58,8 +64,29 @@ public static JdbcSinkConfig of(ReadonlyConfig config) {
         builder.isPrimaryKeyUpdated(config.get(IS_PRIMARY_KEY_UPDATED));
         builder.supportUpsertByInsertOnly(config.get(SUPPORT_UPSERT_BY_INSERT_ONLY));
         builder.simpleSql(config.get(JdbcOptions.QUERY));
-        builder.useCopyStatement(config.get(JdbcOptions.USE_COPY_STATEMENT));

Review Comment:
   how to keep compatibility when set `use_copy_statement = true`?



##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/config/JdbcOptions.java:
##########
@@ -152,18 +152,39 @@ public interface JdbcOptions {
                     .defaultValue(true)
                     .withDescription(
                             "is the primary key updated when performing an update operation");
+
+    Option<JdbcSinkConfig.WriteMode> WRITE_MODE =
+            Options.key("write_mode")
+                    .enumType(JdbcSinkConfig.WriteMode.class)
+                    .defaultValue(JdbcSinkConfig.WriteMode.SQL)
+                    .withDescription("write mode: SQL/COPY/COPY_SQL/MERGE/COPY_MERGE");
+
+    String REPLACE_TARGET_TABLE_NAME_KEY = "${target_table}";

Review Comment:
   Why not reuse https://github.com/apache/seatunnel/blob/757641bada16cf59400723d0720124abee3d1e26/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/TablePlaceholder.java#L32?
   And put update the doc



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org