tap-mysql不返回数据

问题描述 投票:2回答:1

我一直在使用来自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}}

尽管我的表有行

python mysql mysql-python tap
1个回答
0
投票

您需要确保在properties.json文件中将该表标记为“选定”。还请确保指定复制方法类型。

下面的这一部分需要更改

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

to

 "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-methods-and-state-file

© www.soinside.com 2019 - 2024. All rights reserved.