【发布时间】:2019-10-31 23:05:29
【问题描述】:
我试图建立一个带有时间戳列的表的数据库。我正在尝试实现时间戳模式来捕获数据库中的增量更改。
但是 kafka-connect-jdbc 没有从表中读取任何数据。这是我所做的。
创建了一个表。
sqlite> CREATE TABLE test_timestamp(id integer primary key not null,
...> payment_type text not null,
...> Timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
...> user_id int not null);
sqlite> INSERT INTO test_timestamp (ID, PAYMENT_TYPE, USER_ID) VALUES (3,'FOO',1);
sqlite> select * from test_timestamp;
3|FOO|2019-06-18 05:31:22|1
我的jdbc-source连接器配置如下:
$ curl -s "http://localhost:8083/connectors/jdbc-source/config"|jq '.'
{
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"mode": "timestamp",
"timestamp.column.name": "timestamp",
"topic.prefix": "testdb-",
"validate.non.null": "false",
"tasks.max": "1",
"name": "jdbc-source",
"connection.url": "jdbc:sqlite:/tmp/test.db"
}
jdbc-source-connector 成功加载并创建主题
$ kafka-topics --list --bootstrap-server localhost:9092
..
testdb-test_timestamp
但主题中没有数据。
有什么帮助吗?
提前致谢。
【问题讨论】:
-
您可以尝试在配置中包含
"query": "select * from test_timestamp"吗? -
是的。我已经在配置文件中添加了这个,但没有运气。
-
看起来这可以帮助你stackoverflow.com/questions/54518763/…你的时间戳列名称是“时间戳”而不是“时间戳”,尝试改变它。
标签: sqlite jdbc apache-kafka apache-kafka-connect confluent-platform