开发者社区> 问答> 正文

dml和ddl对比了一下,只能通过sql做解析SQL,能否有其他方式??

通过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

展开
收起
古拉古拉 2023-06-21 12:12:52 47 0
1 条回答
写回答
取消 提交回答
  • 没有的

    原回答者GitHub用户 agapple

    2023-06-21 12:59:41
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
神龙云服务器产品及技术深度解析 立即下载
弹性创造价值:基于ECS的最佳性价比实践解析 立即下载
又快又稳:阿里云下一代虚拟交换机解析 立即下载

相关镜像