美文网首页
DataX PG "writeMode"配置

DataX PG "writeMode"配置

作者: 赵优秀 | 来源:发表于2023-09-27 09:36 被阅读0次

    datax配置pg writeMode 參數只有 "insert","update"

    update異常

    ON CONFLICT DO UPDATE requires inference specification or constraint name 2023-09-28 09:02:46 [ExecutorJobHandler.reader-133]   Hint: For example, ON CONFLICT (column_name).
    

    解決:

    update語句找不到主鍵 ,  "writeMode": "update(id)" 
    update模式 手動配置主鍵,如果多個主鍵使用"," 分割.
    

    demo

    {
      "core": {
        "transport": {
          "channel": {
            "speed": {
              "byte": 5242880
            }
          }
        }
      },
      "job": {
        "setting": {
          "speed": {
            "channel": 5
          },
          "errorLimit": {
            "record": 0,
            "percentage": 0.02
          }
        },
        "content": [
          {
            "reader": {
              "name": "postgresqlreader",
              "parameter": {
                "username": "***",
                "password": "***",
                "column": [
                  "id",
                  "entity_uid",
                  "serial_number"
                ],
                "splitPk": "",
                "connection": [
                  {
                    "table": [
                      "tool_archives"
                    ],
                    "jdbcUrl": [
                      "jdbc:postgresql://***"
                    ]
                  }
                ]
              }
            },
            "writer": {
              "name": "postgresqlwriter",
              "parameter": {
                "writeMode": "update(id)",
                "username": "***",
                "password": "***",
                "column": [
                  "id",
                  "entity_uid",
                  "entityversion",
                  "serial_number"
                ],
                "preSql": [
                  ""
                ],
                "connection": [
                  {
                    "table": [
                      "tool_archives"
                    ],
                    "jdbcUrl": "***"
                  }
                ]
              }
            }
          }
        ]
      }
    }
    

    相关文章

      网友评论

          本文标题:DataX PG "writeMode"配置

          本文链接:https://www.haomeiwen.com/subject/ktlkbdtx.html