首页 > 解决方案 > singer.io 增量负载不起作用

问题描述

与 Singer.io 合作,尝试在 Ubuntu 上使用 xampp 从 mysql 获取数据并能够获取历史数据,但随后我尝试获取代码无法正常工作的增量负载。

如果有人可以提供帮助,我将无法获得 replication_key_value,我将非常感谢您。

配置.json:

{
  "host": "localhost",
  "port": "3307",
  "user": "root",
  "password": ""
}

属性.json:

{
  "streams": [
    {
      "tap_stream_id": "test_1-company",
      "table_name": "company",
      "schema": {
        "properties": {
          "COMPANY_ID": {
            "inclusion": "automatic",
            "maxLength": 6,
            "type": [
              "null",
              "string"
            ]
          },
          "COMPANY_NAME": {
            "inclusion": "available",
            "maxLength": 25,
            "type": [
              "null",
              "string"
            ]
          },
          "COMPANY_CITY": {
            "inclusion": "available",
            "maxLength": 25,
            "type": [
              "null",
              "string"
            ]
          }
        },
        "type": "object"
      },
      "stream": "company",
      "metadata": [
        {
          "breadcrumb": [],
          "metadata": {
            "selected-by-default": false,
            "database-name": "test_1",
            "row-count": 7,
            "is-view": false,
            "table-key-properties": [
              "COMPANY_ID"
            ],
            "replication-method": "INCREMENTAL",
            "replication-key": "COMPANY_ID"
          }
        },
        {
          "breadcrumb": [
            "properties",
            "COMPANY_ID"
          ],
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "varchar(6)"
          }
        },
        {
          "breadcrumb": [
            "properties",
            "COMPANY_NAME"
          ],
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "varchar(25)"
          }
        },
        {
          "breadcrumb": [
            "properties",
            "COMPANY_CITY"
          ],
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "varchar(25)"
          }
        }
      ]
    }
  ]
}

控制台日志:

$ tap-mysql -c config.json --properties properties.json
INFO Server Parameters: version: 10.4.14-MariaDB, wait_timeout: 2700, innodb_lock_wait_timeout: 2700, max_allowed_packet: 1048576, interactive_timeout: 28800
INFO Server SSL Parameters (blank means SSL is not active): [ssl_version: ], [ssl_cipher: ]
{"type": "STATE", "value": {"currently_syncing": null}}

标签: pythonmysqlsinger-io

解决方案


你能分享你的可执行文件吗?您的问题可能出在 state.json 文件中。State.json 需要以下形式:

{
   "bookmarks":{
      "123po-employee":{
         "replication_key":"Id",
         "replication_key_value":45,
         "version":1609927544221
      }
   },
   "currently_syncing":null
}

推荐阅读