This is an automated email from the ASF dual-hosted git repository.
davidzollo 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 089379cce5 [Fix][SqliteDialect] Update upsert SQL syntax and add unit
tests for … (#10880)
089379cce5 is described below
commit 089379cce551a0c62b6394cd877801a1decafdd3
Author: Mox <[email protected]>
AuthorDate: Sat May 30 13:41:05 2026 +0800
[Fix][SqliteDialect] Update upsert SQL syntax and add unit tests for …
(#10880)
---
.../internal/dialect/sqlite/SqliteDialect.java | 5 +--
.../internal/dialect/sqlite/SqliteDialectTest.java | 46 ++++++++++++++++++++++
2 files changed, 48 insertions(+), 3 deletions(-)
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialect.java
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialect.java
index f9d08c3e60..bc0a73097c 100644
---
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialect.java
+++
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialect.java
@@ -55,9 +55,8 @@ public class SqliteDialect implements JdbcDialect {
.map(
fieldName ->
quoteIdentifier(fieldName)
- + "=VALUES("
- + quoteIdentifier(fieldName)
- + ")")
+ + "=EXCLUDED."
+ + quoteIdentifier(fieldName))
.collect(Collectors.joining(", "));
String conflictFields =
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialectTest.java
b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialectTest.java
new file mode 100644
index 0000000000..f1c21b1a3e
--- /dev/null
+++
b/seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlite/SqliteDialectTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.seatunnel.connectors.seatunnel.jdbc.internal.dialect.sqlite;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class SqliteDialectTest {
+ @Test
+ void testUpsertStatement() {
+ SqliteDialect dialect = new SqliteDialect();
+ final String database = "seatunnel";
+ final String tableName = "role";
+ final String[] fieldNames = {
+ "id", "type", "role_name", "description", "create_time",
"update_time"
+ };
+ final String[] uniqueKeyFields = {"id"};
+
+ String upsertSql =
+ dialect.getUpsertStatement(database, tableName, fieldNames,
uniqueKeyFields)
+ .orElseThrow(
+ () ->
+ new AssertionError(
+ "Expected upsertSql String to
be present"));
+ // SqliteDialect uses backticks (`) for quoting identifiers (table
only, not database)
+ // Note: SqliteDialect always generates DO UPDATE SET, not DO NOTHING
+ Assertions.assertEquals(
+ "INSERT INTO seatunnel.`role` (`id`, `type`, `role_name`,
`description`, `create_time`, `update_time`) VALUES (:id, :type, :role_name,
:description, :create_time, :update_time) ON CONFLICT(`id`) DO UPDATE SET
`id`=EXCLUDED.`id`, `type`=EXCLUDED.`type`, `role_name`=EXCLUDED.`role_name`,
`description`=EXCLUDED.`description`, `create_time`=EXCLUDED.`create_time`,
`update_time`=EXCLUDED.`update_time`",
+ upsertSql);
+ }
+}