michael-liumh / binlog2sql

danfengcao binlog2sql add json and gtid support, also add binlogfile support.
GNU General Public License v3.0
79 stars 20 forks source link

解析json字段报错 #8

Open liupeipeng opened 1 year ago

liupeipeng commented 1 year ago

我的语句是这样 python3 binlogfile2sql.py -hxxx -uxxxx -p -Pxxx -d xxxx -t xxxx --sql-type='update' --file-path='/root/tmp_binlog/binlog.004018' --start-datetime='2023-08-17 19:30:00' -B > rollback_xxxxx.sql

报错是 image

如果我的语句不对,麻烦您给我个例子(解析某张表从某个时间点以来的全部binlog)

huangwei2013 commented 7 months ago

+1

处理的对象信息是 <pymysqlreplication.row_event.UpdateRowsEvent object at 0x7f6e6cb9f5b0>

报错信息 Traceback (most recent call last): File "/usr/local/rvm/gems/ruby-3.0.0/gems/fluent-plugin-mysql-py-binlog-0.1.0/lib/fluent/plugin/../../../binlog2sql/binlog2sql/binlog2sql.py", line 377, in <module> main(command_line_args) File "/usr/local/rvm/gems/ruby-3.0.0/gems/fluent-plugin-mysql-py-binlog-0.1.0/lib/fluent/plugin/../../../binlog2sql/binlog2sql/binlog2sql.py", line 371, in main binlog2sql.process_binlog() File "/usr/local/rvm/gems/ruby-3.0.0/gems/fluent-plugin-mysql-py-binlog-0.1.0/lib/fluent/plugin/../../../binlog2sql/binlog2sql/binlog2sql.py", line 257, in process_binlog for row in binlog_event.rows: File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/row_event.py", line 433, in rows self._fetch_rows() File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/row_event.py", line 428, in _fetch_rows self.__rows.append(self._fetch_one_row()) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/row_event.py", line 517, in _fetch_one_row row["before_values"] = self._read_column_data(self.columns_present_bitmap) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/row_event.py", line 181, in _read_column_data values[name] = self.packet.read_binary_json(column.length_size) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/packet.py", line 352, in read_binary_json return self.read_binary_json_type(t, length) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/packet.py", line 357, in read_binary_json_type return self.read_binary_json_object(length - 1, large) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/packet.py", line 440, in read_binary_json_object data = self.read_binary_json_type(t, length) File "/usr/local/lib/python3.8/dist-packages/pymysqlreplication/packet.py", line 385, in read_binary_json_type raise ValueError('Json type %d is not handled' % t) ValueError: Json type 15 is not handled