Forráskód Böngészése

fix(datax): postgresql_writer 去 writeMode(DataX pg writer 不支持)

DataX 官方 postgresqlwriter:Job.init 看到 writeMode 参数直接抛
"PostgreSQL 不支持配置参数项 writeMode" —— PG 仅通过 insert SQL 写入,
幂等靠 preSql TRUNCATE 或 ON CONFLICT 实现
plugin load_others 删 writeMode 读取 + ini 删 writeMode 行
冒烟 hdfs-export 首次执行时暴露

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
tianyu.chu 1 hete
szülő
commit
468b3bffbf

+ 2 - 2
dw_base/datax/plugins/writer/postgresql_writer.py

@@ -47,8 +47,8 @@ class PostgreSQLWriter(Writer):
             self.config_parser.get(self.plugin_type, POSTGRE_SQL_WRITER_PARAMETER_POST_SQL).split(';') or []
         self.parameter[POSTGRE_SQL_WRITER_PARAMETER_PRE_SQL] = \
             self.config_parser.get(self.plugin_type, POSTGRE_SQL_WRITER_PARAMETER_PRE_SQL).split(';') or []
-        self.parameter[POSTGRE_SQL_WRITER_PARAMETER_WRITE_MODE] = \
-            self.config_parser.get(self.plugin_type, POSTGRE_SQL_WRITER_PARAMETER_WRITE_MODE) or 'insert'
+        # DataX 官方 postgresqlwriter 不支持 writeMode 参数(PG 仅通过 insert SQL 插入;
+        # 幂等靠 preSql TRUNCATE 或 ON CONFLICT),塞 writeMode 会被 writer init 拒绝
         self.parameter[POSTGRE_SQL_WRITER_PARAMETER_BATCH_SIZE] = \
             self.config_parser.get(self.plugin_type, POSTGRE_SQL_WRITER_PARAMETER_BATCH_SIZE) or '1024'
 

+ 0 - 1
tests/integration/datax/hdfs_export/export_user_cert_info.ini

@@ -26,5 +26,4 @@ column = id,user_id,cert_birthday,cert_sex,cert_province,cert_city,version,statu
 columnType =
 preSql = TRUNCATE TABLE test.ads_usr_app_user_cert_info_export
 postSql =
-writeMode = insert
 batchSize = 1024