tap-mysql不返回任何数据

时间:2018-07-21 14:18:49

标签: python mysql mysql-python tap

我一直在使用singer.io的tap-mysql

下面是我的配置文件:

  

{     “ host”:“ localhost”,     “ port”:“ 3306”,     “ user”:“ root”,     “ 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}}

尽管我的表有行

1 个答案:

答案 0 :(得分:0)

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

下面的这一部分需要更改为

a[1] + b[1]

 "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": []

有关更多说明,请参见GitHub文档示例:https://github.com/singer-io/tap-mysql#replication-methods-and-state-file