[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17705765#comment-17705765 ] melin commented on SPARK-38200: --- upsert sql for different databases, Most databases support merge sql: sqlserver merge into sql : [https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerDialect.java] mysql: [https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/mysql/MysqlDialect.java] oracle merge into sql : [https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oracle/OracleDialect.java] postgres: [https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresDialect.java] db2 merge into sql : [https://www.ibm.com/docs/en/db2-for-zos/12?topic=statements-merge] derby merge into sql: [https://db.apache.org/derby/docs/10.14/ref/rrefsqljmerge.html] he merg into sql : [https://www.tutorialspoint.com/h2_database/h2_database_merge.htm] [~beliefer] [~cloud_fan] > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17574454#comment-17574454 ] melin commented on SPARK-38200: --- Yes, not standard syntax, can it be supported? > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17499424#comment-17499424 ] jiaan.geng commented on SPARK-38200: [~melin] It seems not consistent. > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17495322#comment-17495322 ] melin commented on SPARK-38200: --- [~beliefer] > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17495305#comment-17495305 ] jiaan.geng commented on SPARK-38200: [~melin] OK. Does other SQL could finish the same work as Upsert SQL? > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493642#comment-17493642 ] melin commented on SPARK-38200: --- [~beliefer] Upsert SQL is not ANSI standard, Mysql and PG are very widely used, and many data integration systems support UPSERT. There is a strong need to synchronize data in real business. I hope it can be implemented for mysql and PG. > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > mysql: > {code:java} > replace into t(id, update_time) values(1, now()); {code} > pg: > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) ON CONFLICT > (id,name) DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17493607#comment-17493607 ] jiaan.geng commented on SPARK-38200: [~melin] Thank you for the ping. Does the syntax is an ANSI standard? > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) > ON CONFLICT (id,name) > DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > > replace into t(id, update_time) values(1, now()); {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (SPARK-38200) [SQL] Spark JDBC Savemode Supports replace
[ https://issues.apache.org/jira/browse/SPARK-38200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17491853#comment-17491853 ] melin commented on SPARK-38200: --- [~beliefer] > [SQL] Spark JDBC Savemode Supports replace > -- > > Key: SPARK-38200 > URL: https://issues.apache.org/jira/browse/SPARK-38200 > Project: Spark > Issue Type: Improvement > Components: SQL >Affects Versions: 3.3.0 >Reporter: melin >Priority: Major > > When writing data into a relational database, data duplication needs to be > considered. Both mysql and postgres support upsert syntax. > {code:java} > INSERT INTO %s (id,name,data_time,remark) VALUES ( ?,?,?,? ) > ON CONFLICT (id,name) > DO UPDATE SET > id=excluded.id,name=excluded.name,data_time=excluded.data_time,remark=excluded.remark > > replace into t(id, update_time) values(1, now()); {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org