Kurola-zeno opened a new issue, #10042: URL: https://github.com/apache/seatunnel/issues/10042
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues. ### What happened 2.3.12's seatunnel currently only supports creating transactional tables with specified primary keys in MaxCompute sink, and does not support creating standard tables. Additionally, there is an error in the configuration template on the official website documentation. The default save_mode_create_template should be set with 'transactional'='true' and PRIMARY KEY (`specific fields`) to allow the collection job to proceed normally. However, the default collection template on the official website does not enable transactions or specify primary keys, which will cause the job to fail with a prompt indicating that the primary key is missing or does not exist. MaxCompute's standard tables do not support primary key constraints, so the template settings must enable transactional operations.The source has already been confirmed as a primary key MySQL table. <img width="1498" height="661" alt="Image" src="https://github.com/user-attachments/assets/730250d1-3a48-4db9-abf3-c62b9b074afa" /> Solution:maxcompute sink template should be: sink { Maxcompute { accessId = "******" accesskey = "*******" endpoint = "*******/api" project = "******" table_name = "zbx_payment_info" schema_save_mode = "RECREATE_SCHEMA" data_save_mode = "DROP_DATA" save_mode_create_template = "CREATE TABLE IF NOT EXISTS `${table}` (${rowtype_fields}, PRIMARY KEY (`id`))TBLPROPERTIES ('transactional'='true','comment'='${comment}');" } ### SeaTunnel Version 2.3.12 ### SeaTunnel Config ```conf env { parallelism = 4 job.mode = "BATCH" } source { Jdbc { url = "jdbc:mysql://******8.mysql.rds.aliyuncs.com:3306/***?serverTimezone=GMT%2b8&useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true" driver = "com.mysql.cj.jdbc.Driver" connection_check_timeout_sec = 100 username = "*******" password = "*******" query = "select * from zbx_payment_info limit 16;" } } transform { } sink { Maxcompute { accessId = "******" accesskey = "*******" endpoint = "*******/api" project = "******" table_name = "zbx_payment_info" schema_save_mode = "RECREATE_SCHEMA" data_save_mode = "DROP_DATA" save_mode_create_template = "CREATE TABLE IF NOT EXISTS `${table}` (${rowtype_fields}, PRIMARY KEY (`id`))TBLPROPERTIES ('transactional'='true','comment'='${comment}');" } } ``` ### Running Command ```shell seatunnel.sh --config mysql2mc_test.conf -m local ``` ### Error Exception ```log log: Caused by: org.apache.seatunnel.common.exception.SeaTunnelRuntimeException: ErrorCode:[COMMON-23], ErrorDescription:[Maxcompute write SeaTunnelRow failed, the SeaTunnelRow value is 'SeaTunnelRow{tableId=shucang_test.zbx_payment_info, kind=+I, fields=[35245, 696587184968912, 47177, 6, 1102, null, 9197.00, Apple iPhone 12 (A2404) 128GB 黑色 支持移动联通电信5G 双卡双待手机等1件商品, 1602, 2022-06-11T09:41:02, 2022-06-11T09:41:02, callback xxxxxxx, 2022-06-11T09:41:02]}'.] at org.apache.seatunnel.common.exception.CommonError.writeSeaTunnelRowFailed(CommonError.java:97) at org.apache.seatunnel.connectors.seatunnel.maxcompute.sink.MaxcomputeWriter.write(MaxcomputeWriter.java:56) at org.apache.seatunnel.connectors.seatunnel.maxcompute.sink.MaxcomputeWriter.write(MaxcomputeWriter.java:35) at org.apache.seatunnel.api.sink.multitablesink.MultiTableWriterRunnable.run(MultiTableWriterRunnable.java:67) ... 6 more Caused by: RequestId=20251105190700df8a341a02d2de97, ErrorCode=MethodNotAllowed, ErrorMessage=Primary key not found or invalid at com.aliyun.odps.tunnel.impl.SessionBase.httpRequestWithNoRetry(SessionBase.java:65) at com.aliyun.odps.tunnel.impl.SessionBase.lambda$httpRequest$0(SessionBase.java:91) at com.aliyun.odps.tunnel.io.TunnelRetryHandler.executeWithRetry(TunnelRetryHandler.java:105) at com.aliyun.odps.tunnel.io.TunnelRetryHandler.executeWithRetry(TunnelRetryHandler.java:97) at com.aliyun.odps.tunnel.impl.SessionBase.httpRequest(SessionBase.java:90) at com.aliyun.odps.tunnel.impl.UpsertSessionImpl.initiate(UpsertSessionImpl.java:268) at com.aliyun.odps.tunnel.impl.UpsertSessionImpl.<init>(UpsertSessionImpl.java:96) at com.aliyun.odps.tunnel.impl.UpsertSessionImpl$Builder.build(UpsertSessionImpl.java:677) at com.aliyun.odps.tunnel.impl.UpsertSessionImpl$Builder.build(UpsertSessionImpl.java:535) at org.apache.seatunnel.connectors.seatunnel.maxcompute.util.MaxcomputeOutputFormat.initializeUpsertSession(MaxcomputeOutputFormat.java:129) at org.apache.seatunnel.connectors.seatunnel.maxcompute.util.MaxcomputeOutputFormat.ensureUpsertSessionAndWriter(MaxcomputeOutputFormat.java:104) at org.apache.seatunnel.connectors.seatunnel.maxcompute.util.MaxcomputeOutputFormat.write(MaxcomputeOutputFormat.java:58) at org.apache.seatunnel.connectors.seatunnel.maxcompute.sink.MaxcomputeWriter.write(MaxcomputeWriter.java:52) ... 8 more at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:220) ... 2 more ``` ### Zeta or Flink or Spark Version zeta:2.3.12 ### Java or Scala Version java1.8 ### Screenshots <img width="1498" height="661" alt="Image" src="https://github.com/user-attachments/assets/c96ace3a-b381-4fe1-9e80-b018f3d26658" /> ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
