Comments (7)
我今天发现tinyint类型数据解析的数据有问题,tinyint类型数据 0,解析后是 字符串128
-
tinyint的数据我没验证过, 如果不符合要求,请自己修改相关代码, 也可以等下一个版本更新(时间不确定, 最近有点忙), 目前验证过的数据类型为varchar,char, date, int, time,timestamp,datetime
-
DDL的属性目前只解析了是否为空(is_nullable),是否有默认值(default_value_utf8),注释(comment), 但是注释未加关键词comment和引号.... (未解析符号等其它属性)
就像下面这样
(venv) 18:57:56 [root@ddcw21 innodb_parse]#python main.py --ddl /data/mysql_3314/mysqldata/db1/t20230821_2.ibd
CREATE Table db1.t20230821_2(
id int NOT NULL ,
id2 tinyint NULL test tiny int,
id3 year NULL ,
PRIMARY KEY(id)) ENGINE=InnoDB test ibd2sql;
from ibd2sql.
bigint类型数据做ddl里是正常能解析出来的,但是在数据里bigint类型数据都是None,而且主键字段好像也没有生成ddl标识,可以优化吗
- 对于bigint的支持, 目前未解析bigint的数据(忘了, tinyint倒是解析了...), 对于未解析的数据, 都是返回None,
bigint和其它数据类型(不含LOB和JSON)将在下一个版本支持.
若现在需要的话, 可以编辑innodb_type.py
文件, 在第77行处添加如下代码即可
if dtype == 'bigint':
_t = struct.unpack('>Q',bdata[:8])[0]
return (_t&((1<<63)-1)) if _t&(1<<63) else -(_t&((1<<63)-1))
- 目前是支持主键(在最后一行)的, 如下为使用例子:
(venv) 09:46:47 [root@ddcw21 innodb_parse]#python main.py --ddl --sql /data/mysql_3314/mysqldata/db1/t20230820.ibd
CREATE Table db1.t20230820(
id int NOT NULL ,
aa bigint NULL ,
PRIMARY KEY(id)) ENGINE=InnoDB ;
insert into db1.t20230820 values("1","1");
insert into db1.t20230820 values("111111111","11111111111111");
(venv) 09:47:36 [root@ddcw21 innodb_parse]#
from ibd2sql.
感谢🙏
from ibd2sql.
请问下能字段备注和表备注,默认值这些能处理吗?现在的 sql不是很标准,有这些属性的话
from ibd2sql.
我今天发现tinyint类型数据解析的数据有问题,tinyint类型数据 0,解析后是 字符串128
from ibd2sql.
好的,了解😀
from ibd2sql.
我今天发现tinyint类型数据解析的数据有问题,tinyint类型数据 0,解析后是 字符串128
我刚试了下, tinyint的数据 未做符号判断,(其它的也没做符号判断, 但都是当作有符号来解析的,), 下一个版本再做符号判断吧...
临时解决办法, 编辑innodb_type.py
文件的第77行处添加如下代码即可(和bigint一样处理方法...)
if dtype == 'tinyint':
tdata = struct.unpack('>B',bdata)[0]
return -(128-tdata) if tdata < 128 else tdata -128
效果:
(venv) 17:32:18 [root@ddcw21 innodb_parse]#python main.py --sql /data/mysql_3314/mysqldata/db1/t20230825.ibd
insert into db1.t20230825 values("1","-2");
insert into db1.t20230825 values("2","-1");
insert into db1.t20230825 values("3","0");
insert into db1.t20230825 values("4","1");
insert into db1.t20230825 values("5","2");
(venv) 17:32:19 [root@ddcw21 innodb_parse]#
from ibd2sql.
Related Issues (20)
- 大佬,可不可以出一个5.7版本的...或者5.7版本的ibd有什么别的解决思路嘛?谢谢大佬(滑跪~ HOT 1
- ibd2sql解析表结构DDL问题 HOT 2
- KeyError: 32 [27124] Failed to execute script 'main' due to unhandled exception! 测试报错 HOT 3
- 读取ibd时报错 KeyError: 'hidden' HOT 2
- datetime、int类型的数据解析异常 HOT 7
- --sql 参数解析idb数据 varchar、text、int 、bigint类型解析出的数据有问题! HOT 15
- 能否可以支持自己指定表ddl创建语句 HOT 1
- 感激,分分钟解决问题 HOT 2
- 老铁可以支持导出功能吗,导出来txt或者.sql格式的文件呢,谢谢 HOT 1
- 老铁,不是我说你,遮遮掩掩的。 HOT 2
- 解析5.7 ibd文件失败,没有任何输出 HOT 4
- 执行命令的时候报错 row_format = compressed or its damaged or its mysql 5.7 file HOT 3
- --ddl 生成错的 `!hidden!_dropped_v1_p13_status` NULL, 这怎么解决 HOT 4
- 恢复数据时报错RecursionError: maximum recursion depth exceeded,网上找了解决方案后执行不报错,但数据有缺失 HOT 5
- 你好,没有看到任何数据,在8.0里面生成的ibd 库名也要对应吗,我是从5.7导出create语句,在8.0执行的 HOT 7
- first_blob 方法 解包异常 HOT 12
- 你好,mysql8.0 数据恢复有问题 HOT 4
- 说几个使用体验吧 HOT 1
- 转换的时候乱码了 HOT 4
- noob_loop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ibd2sql.