tap mysql不返回任何数据

cigdeys3  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(404)

我一直在使用singer.io的tap-mysql
下面是我的配置文件:
{“host”:“localhost”,“port”:“3306”,“user”:“root”,“password”:“password”}
这将成功返回上的架构 --discover 我的属性文件是:

{
  "streams": [
    {
      "key_properties": [
        "id"
      ],
      "tap_stream_id": "example_db-animals",
      "schema": {
  "selected": "true",
  "properties": {
    "likes_getting_petted": {
      "selected": "true",
      "inclusion": "available",
      "type": [
        "null",
        "boolean"
      ]
    },
    "name": {
      "selected": "true",
      "maxLength": 255,
      "inclusion": "available",
      "type": [
        "null",
        "string"
      ]
    },
    "id": {
      "selected": "true",
      "minimum": -2147483648,
      "inclusion": "automatic",
      "maximum": 2147483647,
      "type": [
        "null",
        "integer"
      ]
    }
  },
  "type": "object"
},
      "table_name": "animals",
      "metadata": [
        {
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "int(11)"
          },
          "breadcrumb": [
            "properties",
            "id"
          ]
        },
        {
          "metadata": {
            "database-name": "example_db",
            "selected-by-default": false,
            "is-view": false,
            "row-count": 3
          },
          "breadcrumb": []
        },
        {
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "varchar(255)"
          },
          "breadcrumb": [
            "properties",
            "name"
          ]
        },
        {
          "metadata": {
            "selected-by-default": true,
            "sql-datatype": "tinyint(1)"
          },
          "breadcrumb": [
            "properties",
            "likes_getting_petted"
          ]
        }
      ],
      "stream": "animals"
    }
  ]
}

我已添加选定的标志。
按以下命令

$ tap-mysql -c config.json --properties properties.json

,我收到以下回复

{"type": "STATE", "value": {"currently_syncing": null}}

虽然我的table有行

mspsb9vt

mspsb9vt1#

您需要确保在properties.json文件中将该表标记为“selected”。还要确保指定复制方法类型。
以下部分需要从

"metadata": {
     "database-name": "example_db",
     "selected-by-default": false,
     "is-view": false,
     "row-count": 3
 },
 "breadcrumb": []

"metadata": {
     "database-name": "example_db",
     "selected-by-default": false,
     "is-view": false,
     "row-count": 3,
     "selected": true,
     "replication-method": "FULL_TABLE"
 },
 "breadcrumb": []

我认为你缺少的两个部分是下面的两行:

"selected": true,
"replication-method": "FULL_TABLE"

请参阅github文档示例以获取进一步的说明:https://github.com/singer-io/tap-mysql#replication-方法和状态文件

相关问题