通过mysql增量数据同步到pg库,看了只能从RowChange sql参数语句做解析,还有其他便捷方式吗? dml语句: Entry result:header { version: 1 logfileName: "mysql-bin.006342" logfileOffset: 270837746 serverId: 3 serverenCode: "UTF-8" executeTime: 1513309772000 sourceType: MYSQL schemaName: "test" tableName: "account_user_info_stream_test" eventLength: 79 eventType: INSERT } entryType: ROWDATA storeValue: "\b\307\317\002\020\001P\000b\345\003\0226\b\000\020\f\032\006userId \001(\0010\000B\02500002DED643D4D3322354R\vvarchar(64)\022!\b\001\020\f\032\brealName \000(\0010\001R\vvarchar(32)\022!\b\002\020\f\032\bidCardNo \000(\0010\001R\vvarchar(18)\022 \b\003\020\f\032\006avatar \000(\0010\001R\fvarchar(128)\022!\b\004\020\f\032\bprovince \000(\0010\001R\vvarchar(32)\022\035\b\005\020\f\032\004city \000(\0010\001R\vvarchar(32)\022\037\b\006\020\f\032\006county \000(\0010\001R\vvarchar(32)\022!\b\a\020\f\032\aaddress \000(\0010\001R\fvarchar(128)\022,\b\b\020\f\032\freferralCode \000(\0010\000B\0069504A5R\nvarchar(6)\022 \b\t\020\004\032\tisdeleted \000(\0010\000B\0010R\006int(1)\0225\b\n\020]\032\tcreatedon \000(\0010\000B\0232016-01-01 14:46:20R\ttimestamp\0226\b\v\020]\032\nmodifiedon \000(\0010\000B\0232016-05-26 11:21:32R\ttimestamp"
RowChange result: tableId: 42951 eventType: INSERT isDdl: false rowDatas { afterColumns { index: 0 sqlType: 12 name: "userId" isKey: true updated: true isNull: false value: "00002DED643D4D3322354" mysqlType: "varchar(64)" } afterColumns { index: 1 sqlType: 12 name: "realName" isKey: false updated: true isNull: true mysqlType: "varchar(32)" } afterColumns { index: 2 sqlType: 12 name: "idCardNo" isKey: false updated: true isNull: true mysqlType: "varchar(18)" } afterColumns { index: 3 sqlType: 12 name: "avatar" isKey: false updated: true isNull: true mysqlType: "varchar(128)" } afterColumns { index: 4 sqlType: 12 name: "province" isKey: false updated: true isNull: true mysqlType: "varchar(32)" } afterColumns { index: 5 sqlType: 12 name: "city" isKey: false updated: true isNull: true mysqlType: "varchar(32)" } afterColumns { index: 6 sqlType: 12 name: "county" isKey: false updated: true isNull: true mysqlType: "varchar(32)" } afterColumns { index: 7 sqlType: 12 name: "address" isKey: false updated: true isNull: true mysqlType: "varchar(128)" } afterColumns { index: 8 sqlType: 12 name: "referralCode" isKey: false updated: true isNull: false value: "9504A5" mysqlType: "varchar(6)" } afterColumns { index: 9 sqlType: 4 name: "isdeleted" isKey: false updated: true isNull: false value: "0" mysqlType: "int(1)" } afterColumns { index: 10 sqlType: 93 name: "createdon" isKey: false updated: true isNull: false value: "2016-01-01 14:46:20" mysqlType: "timestamp" } afterColumns { index: 11 sqlType: 93 name: "modifiedon" isKey: false updated: true isNull: false value: "2016-05-26 11:21:32" mysqlType: "timestamp" } }
ddl语句:
Entry result:header { version: 1 logfileName: "mysql-bin.006342" logfileOffset: 289467408 serverId: 3 serverenCode: "UTF-8" executeTime: 1513312501000 sourceType: MYSQL schemaName: "test" tableName: "account_user_info_stream_test" eventLength: 195 eventType: ALTER } entryType: ROWDATA storeValue: "\020\005P\001ZyALTER TABLE account_user_info_stream_test\r\nDROP COLUMN test,\r\nADD COLUMN test varchar(255) NULL AFTER modifiedonr\004test"
2017-12-15 14:18:45,943 (main) [INFO - com.trcloud.hamal.stream.core.operator.impl.canal.CanalSource.fetchEvent(CanalSource.java:127)] RowChange result:eventType: ALTER isDdl: true sql: "ALTER TABLE account_user_info_stream_test\r\nDROP COLUMN test,\r\nADD COLUMN test varchar(255) NULL AFTER modifiedon" ddlSchemaName: "test"
原提问者GitHub用户 liuwenfeng554
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。