1. <small id='dBZaq'></small><noframes id='dBZaq'>

    1. <i id='dBZaq'><tr id='dBZaq'><dt id='dBZaq'><q id='dBZaq'><span id='dBZaq'><b id='dBZaq'><form id='dBZaq'><ins id='dBZaq'></ins><ul id='dBZaq'></ul><sub id='dBZaq'></sub></form><legend id='dBZaq'></legend><bdo id='dBZaq'><pre id='dBZaq'><center id='dBZaq'></center></pre></bdo></b><th id='dBZaq'></th></span></q></dt></tr></i><div id='dBZaq'><tfoot id='dBZaq'></tfoot><dl id='dBZaq'><fieldset id='dBZaq'></fieldset></dl></div>
    2. <legend id='dBZaq'><style id='dBZaq'><dir id='dBZaq'><q id='dBZaq'></q></dir></style></legend>

        <bdo id='dBZaq'></bdo><ul id='dBZaq'></ul>
      <tfoot id='dBZaq'></tfoot>

      Kafka JDBC 源连接器时间戳模式对 sqlite3 失败

      时间:2023-08-22

      1. <tfoot id='e8hxJ'></tfoot>

        <small id='e8hxJ'></small><noframes id='e8hxJ'>

        1. <legend id='e8hxJ'><style id='e8hxJ'><dir id='e8hxJ'><q id='e8hxJ'></q></dir></style></legend>
            <tbody id='e8hxJ'></tbody>

              • <bdo id='e8hxJ'></bdo><ul id='e8hxJ'></ul>
                <i id='e8hxJ'><tr id='e8hxJ'><dt id='e8hxJ'><q id='e8hxJ'><span id='e8hxJ'><b id='e8hxJ'><form id='e8hxJ'><ins id='e8hxJ'></ins><ul id='e8hxJ'></ul><sub id='e8hxJ'></sub></form><legend id='e8hxJ'></legend><bdo id='e8hxJ'><pre id='e8hxJ'><center id='e8hxJ'></center></pre></bdo></b><th id='e8hxJ'></th></span></q></dt></tr></i><div id='e8hxJ'><tfoot id='e8hxJ'></tfoot><dl id='e8hxJ'><fieldset id='e8hxJ'></fieldset></dl></div>
                本文介绍了Kafka JDBC 源连接器时间戳模式对 sqlite3 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我试图在 sqlite 中建立一个包含两个表的数据库.我的一个表有一个时间戳列.我正在尝试实施时间戳模式来捕获数据库中的增量更改.Kafka 连接失败并出现以下错误:

                I tried to set up a database with two tables in sqlite. Once of my table is having a timestamp column . I am trying to implement timestamp mode to capture incremental changes in the DB. Kafka connect is failing with the below error:

                 ERROR Failed to get current time from DB using Sqlite and query 'SELECT 
                CURRENT_TIMESTAMP' 
                (io.confluent.connect.jdbc.dialect.SqliteDatabaseDialect:471)
                java.sql.SQLException: Error parsing time stamp
                
                Caused by: java.text.ParseException: Unparseable date: "2019-02-05 02:05:29" 
                does not match (\p{Nd}++)\Q-\E(\p{Nd}++)\Q-\E(\p{Nd}++)\Q 
                \E(\p{Nd}++)\Q:\E(\p{Nd}++)\Q:\E(\p{Nd}++)\Q.\E(\p{Nd}++)
                

                非常感谢您的帮助

                配置:

                name=test-query-sqlite-jdbc-autoincrement 
                connector.class=io.confluent.connect.jdbc.JdbcSourceConnector 
                tasks.max=1 
                connection.url=jdbc:sqlite:employee.db 
                query=SELECT users.id, users.name, transactions.timestamp, transactions.payment_type FROM users JOIN transactions ON (users.id = transactions.user_id) 
                mode=timestamp 
                timestamp.column.name=timestamp 
                topic.prefix=test-joined
                

                DDL:

                CREATE TABLE transactions(id integer primary key not null,
                                          payment_type text not null,
                                          timestamp DATETIME DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')),
                                          user_id int not null, 
                                          constraint fk foreign key(user_id) references users(id)
                ); 
                
                CREATE TABLE users (id integer primary key not null,name text not null);
                

                推荐答案

                kafka connect jdbc 连接器很容易检测到时间戳的变化,如果 'timestamp' 列的值是 'UNIX timestamp' 的格式.

                The kafka connect jdbc connector easily detects the changes in the timestamp, if the values of the 'timestamp' column are in the format of the 'UNIX timestamp'.

                sqlite> CREATE TABLE transact(timestamp TIMESTAMP DEFAULT (STRFTIME('%s', 'now')) not null,
                   ...> id integer primary key not null,
                   ...> payment_type text not null);
                sqlite>
                

                值可以插入为:

                sqlite> INSERT INTO transact(timestamp,payment_type,id) VALUES (STRFTIME('%s', 'now'),'cash',1);
                

                然后由 kafka jdbc 源连接器检测与时间戳相关的更改,并且可以按如下方式使用:

                The timestamp related changes are then detected by the kafka jdbc source connector and the same can be consumed as follows:

                kafka-console-consumer  --bootstrap-server localhost:9092 --topic jdbc-transact --from-beginning
                {"timestamp":1562321516,"id":2,"payment_type":"card"}
                {"timestamp":1562321790,"id":1,"payment_type":"online"}
                

                这篇关于Kafka JDBC 源连接器时间戳模式对 sqlite3 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:用于生产中 rds 的 Mysql debezium 连接器导致死锁 下一篇:如何从Apache Kafka中的远程数据库中提取数据?

                相关文章

                最新文章

                  • <bdo id='vX6c3'></bdo><ul id='vX6c3'></ul>
                  <tfoot id='vX6c3'></tfoot>

                  <small id='vX6c3'></small><noframes id='vX6c3'>

                    <i id='vX6c3'><tr id='vX6c3'><dt id='vX6c3'><q id='vX6c3'><span id='vX6c3'><b id='vX6c3'><form id='vX6c3'><ins id='vX6c3'></ins><ul id='vX6c3'></ul><sub id='vX6c3'></sub></form><legend id='vX6c3'></legend><bdo id='vX6c3'><pre id='vX6c3'><center id='vX6c3'></center></pre></bdo></b><th id='vX6c3'></th></span></q></dt></tr></i><div id='vX6c3'><tfoot id='vX6c3'></tfoot><dl id='vX6c3'><fieldset id='vX6c3'></fieldset></dl></div>
                  1. <legend id='vX6c3'><style id='vX6c3'><dir id='vX6c3'><q id='vX6c3'></q></dir></style></legend>