tap-mysql returns no data… here is a solution to the problem.
tap-mysql returns no data
I’ve been using tap-mysql for singer.io
Here is my profile:
{
“host”: “localhost”,
“port”: “3306”,
“user”: “root”,
“password”: “password”}
This will successfully return the schema on --discover
My properties file is:
{
"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"
}
]
}
I have added the selected flags.
According to the following command
$ tap-mysql -c config.json --properties properties.json
I received the following response
{"type": "STATE", "value": {"currently_syncing": null}}
Although my table has rows
Solution
You need to make sure that the table is marked as selected in the properties.json file. Also make sure that you specify the copy method type.
The following section needs to be modified
"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": []
I think the two parts you are missing are the following two lines:
"selected": true,
"replication-method": "FULL_TABLE"
For further instructions, see the GitHub documentation example: https://github.com/singer-io/tap-mysql#replication-methods-and-state-file