forked from gangly/datafaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ligangc
committed
Mar 28, 2020
1 parent
33e865b
commit 9f8c410
Showing
6 changed files
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,27 +60,7 @@ create table stu ( | |
|
||
``` | ||
|
||
### 5.3 从本地文件meta.txt中读取元数据,以,,分隔符构造10条数据,打印在屏幕上 | ||
---------------- | ||
|
||
``` | ||
$ datafaker rdb mysql+mysqldb://root:root@localhost:3600/test?charset=utf8 stu 10 --outprint --meta meta.txt --outspliter ',,' | ||
1,,鲍红,,人和中心,,高小王子,,3,,81,,55.6,,13197453222,,[email protected],,192.100.224.255,,江苏省西宁市梁平朱路I座 944204 | ||
2,,刘东,,清华中学,,高小王子,,3,,31,,52.4,,15206198472,,[email protected],,203.0.190.6,,内蒙古自治区嘉禾市兴山呼和浩特街E座 706421 | ||
3,,匡静,,人和中心,,歌神,,9,,84,,72.51,,18944398099,,[email protected],,203.1.53.166,,安徽省永安市沈河惠州街x座 345415 | ||
4,,王宇,,猪场,,逗比,,6,,89,,19.3,,18628114285,,[email protected],,169.4.126.215,,山西省梧州县朝阳何路y座 846430 | ||
5,,陆桂芝,,猪场,,逗比,,8,,99,,92.22,,13304570255,,[email protected],,168.136.127.200,,江苏省英县徐汇尹街C座 908240 | ||
6,,顾阳,,猪场,,歌神,,9,,32,,43.14,,18025578420,,[email protected],,174.50.222.39,,黑龍江省惠州县梁平大冶街Z座 611736 | ||
7,,杨洁,,人和中心,,鬼泣,,6,,35,,81.25,,13654306263,,[email protected],,100.57.79.2,,湖北省琳市沙湾汪街V座 544660 | ||
8,,申璐,,人和中心,,鬼泣,,6,,14,,73.61,,13866020503,,[email protected],,198.248.254.56,,陕西省合山县东丽宁德街Q座 810017 | ||
9,,申强,,广东中学,,逗比,,7,,48,,90.65,,13915915013,,[email protected],,169.210.122.39,,甘肃省冬梅县城北六安街Z座 619755 | ||
10,,李丹丹,,旧大院,,鬼泣,,3,,67,,87.63,,18899812516,,[email protected],,192.52.218.133,,湖南省宜都县萧山澳门街E座 791911 | ||
generated records : 10 | ||
printed records : 10 | ||
time used: 0.458 s | ||
``` | ||
这是个学生表描述。 | ||
编写元数据meta.txt,这是个学生表描述。 | ||
其中meta.txt文件内容为: | ||
``` | ||
id||int||自增id[:inc(id,1)] | ||
|
@@ -113,7 +93,29 @@ name不加标记则会随机产生20字符内的字符串,可以加上改为 | |
后面将详细介绍构造规则说明 | ||
|
||
注意:meta.txt和names.txt需要放在同一个目录下,再运行datafaker命令 | ||
如果没有enum类型,则不需要names.txt文件 | ||
如果没有enum类型从文件读取数据,则不需要names.txt文件 | ||
|
||
### 5.3 从本地文件meta.txt中读取元数据,以,,分隔符构造10条数据,打印在屏幕上 | ||
---------------- | ||
|
||
``` | ||
$ datafaker rdb mysql+mysqldb://root:root@localhost:3600/test?charset=utf8 stu 10 --outprint --meta meta.txt --outspliter ',,' | ||
1,,鲍红,,人和中心,,高小王子,,3,,81,,55.6,,13197453222,,[email protected],,192.100.224.255,,江苏省西宁市梁平朱路I座 944204 | ||
2,,刘东,,清华中学,,高小王子,,3,,31,,52.4,,15206198472,,[email protected],,203.0.190.6,,内蒙古自治区嘉禾市兴山呼和浩特街E座 706421 | ||
3,,匡静,,人和中心,,歌神,,9,,84,,72.51,,18944398099,,[email protected],,203.1.53.166,,安徽省永安市沈河惠州街x座 345415 | ||
4,,王宇,,猪场,,逗比,,6,,89,,19.3,,18628114285,,[email protected],,169.4.126.215,,山西省梧州县朝阳何路y座 846430 | ||
5,,陆桂芝,,猪场,,逗比,,8,,99,,92.22,,13304570255,,[email protected],,168.136.127.200,,江苏省英县徐汇尹街C座 908240 | ||
6,,顾阳,,猪场,,歌神,,9,,32,,43.14,,18025578420,,[email protected],,174.50.222.39,,黑龍江省惠州县梁平大冶街Z座 611736 | ||
7,,杨洁,,人和中心,,鬼泣,,6,,35,,81.25,,13654306263,,[email protected],,100.57.79.2,,湖北省琳市沙湾汪街V座 544660 | ||
8,,申璐,,人和中心,,鬼泣,,6,,14,,73.61,,13866020503,,[email protected],,198.248.254.56,,陕西省合山县东丽宁德街Q座 810017 | ||
9,,申强,,广东中学,,逗比,,7,,48,,90.65,,13915915013,,[email protected],,169.210.122.39,,甘肃省冬梅县城北六安街Z座 619755 | ||
10,,李丹丹,,旧大院,,鬼泣,,3,,67,,87.63,,18899812516,,[email protected],,192.52.218.133,,湖南省宜都县萧山澳门街E座 791911 | ||
generated records : 10 | ||
printed records : 10 | ||
time used: 0.458 s | ||
``` | ||
|
||
|
||
|
||
```sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters