-
Notifications
You must be signed in to change notification settings - Fork 50
/
usage.txt
70 lines (54 loc) · 5.03 KB
/
usage.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ZenData is a generic data generator. You can use YAML file to define the data format and use zendata to create it.
Parameters:
-d --default The default config file for data format.
-c --config The current config file for data format, and it can override the config in the default file.
-o --output The file name of the data generated. You can specify the output format by the extension name.
For example json, xml, sql, csv and xlsx. The text data in the original format is output by default.
Note: For SQL files, you can use --db to specify a specific database type in Mysql,Oracle,SqlServer.
-n --lines The number of lines of data to be generated. The default is 10.
-F --field This parameter can be used to specify the fields, separated by commas. The default is all fields.
-T --trim Remove the prefix and postfix of every field when outputting data or decode data to json string.
-H --human Output a readable format, print the field name, and use the tab key to split.
-r --recursive Recursive mode. The default mode is parallel, in which each field loops independently.
The value of a field in the recursive mode depends on that of the previous field, which enables the random data.
-t --table If the output format is sql, using it to specify the table name to insert data to.
--dsn Specify MySQL, SqlServer or Oracle data source connection string, used to insert data to table directly.
--clear Remove data in MySQL table before insert.
-s Run HTTP service for data administration and generation.
-p --port Specify the port of HTTP service.
-R --root The root directory when generate data OR running HTTP. The client can call the config file under the root directory.
If not specified, take the directory where the zd executable file is located.
--parse Specify a dsn, sql schema OR article text file, used to generate YAML config file for it.
You need to specify an output directory by using -o.
-i --input Specify a Schema(.sql)OR Article(.txt)file to parse.
-l --list List user's data in current dir.
-L List build-in data in ZenData install dir.
-v --view View detailed definition of a data or resource format.
-h --help Print help.
-e --example Print the data format config file of the example.
Command Line Examples:
$>zd.exe -d demo\default.yaml # Generate 10 lines of data according to the config file specified by -d.
$>zd.exe -c demo\default.yaml # Generate 10 lines of data according to the config file specified by -c.
$>zd.exe -c demo\default.yaml -r # Generate 10 lines of data according to the config file specified by -c recursively.
$>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 # Using the parameter of -c and -d at the same time.
$>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.txt # Output data in original format.
$>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.json # Output data in JSON.
$>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.xml # Output data in XML.
$>zd.exe -d demo\default.yaml -n 100 -o test.sql -t user # Output the sql inserted into the table user.
$>zd.exe -d demo\default.yaml -o test.sql -t user -s mysql --trim # Remove the prefix and postfix of every field.
$>zd.exe -c test\test-sql.yaml -t zendata.table_a --trim -dsn mysql://root:[email protected]:3306/zendata#utf8 --clear # Insert data to MySQL table.
$>zd.exe -parse -i demo\zentao.sql -o db # Generate YAML files for each table by parsing zentao.sql.
$>zd.exe -parse -i demo\article.txt -o demo # Convert article text to yaml config file in demo dir.
$>zd.exe -parse -dsn root:P2ssw0rd@(127.0.0.1:3306)/test?charset=utf8&parseTime=True&loc=Local -table table1 -o db
# Generate YAML files for given table in database.
$>zd.exe -l # List all build-in data types.
$>zd.exe -v address.cn.v1 # View data types in build-in Excel file data\address\cn.v1.xlsx.
$>zd.exe -v address.cn.v1.china # View data items in Excel sheet "china".
$>zd.exe -v ip.v1.yaml # View data in build-in instances defined in yaml\ip\v1.yaml。
Service Example:
$zd.exe -p 80 # Listen port 80. Use the directory of zd.exe as the root.
$zd.exe -p 80 -R d:\zd\config # Listen port 80. Use d:\zd\config as the root.
Client Call:
$curl http://localhost:8848/data?d=demo/default.yaml&c=demo/config.yaml&n=100&T=true # Specify the server config file via GET.
$curl http://localhost:8848/data?default=demo/default.yaml&output=test.sql&table=user # Parameter names can be full.
$curl -i -X POST "http://localhost:8848/data?lines=3&trim=true" -F default=@demo/default.yaml # The config can be uploaded via POST.