Set Scheduling Tasks Through Command Line Tools

<< Click to Display Table of Contents >>

Current:  Schedule Tasks 

Set Scheduling Tasks Through Command Line Tools

Previous pageReturn to chapter overviewNext page

Command Line is also called as CMD command, which is an independent module of YonghongZ-Suite that can be used by the user who is fond of operation by command. The product does not need to be started during the application of Command Line Tool. It is equal to the functions of certain tasks in schedule tasks. It mainly supports three commands: 

expcsv: that exporting data of data set to CSV file is equal to exporting data from schedule tasks to CSV file. 

expdb: Export the data of data set to database which is equal to exporting data from schedule tasks to database. Note: Yonghong X-Suite and Y-Reporting do not support exporting to the database.

import: that importing data of data set to DATA MART MPP data mart is equal to the increment imported data in schedule tasks. 

Start the Command Line 

Run the command startCMD.bat(Start startCMD.s under Linux system) under installation directory to start the Command Line. 

命令行工具1

After starting the Command Line, input help command, and introduction of four commands supported by Command Line appears, as shown in the image:

clip1463

 

expcsv: export the data set execution result in csv format to the local file system. 

expdb: Export the data set result to specified database.

import: import the data set execution result in the mart. 

quit: quit the Command Line. 

Export to CSV file

When the user uses expcsv, the user can check the parameter introduction only by input help expcsv, as shown in the image: 

clip1464

-q: the required specified option. The specified data set file. the data set file type should be supported by the system.

-d: the required specified option. The path which csv file will save to, the write permission of should be ensured for the user. 

-p: optional option. Provide the parameter if Data Set need, e.g. "name1=value1;name2=value2".

-fl: optional option. The filter condition specifically added to data set, for example: "ID>20andID<100".

-r: optional option. The recorded number of exported data is exported all data by default. 

After adding the attribute cmd.csv.file.row (such as cmd.csv.file.row=500) in bi.properties, restart Command Line to control the maximum data row of exported csv file. 

For example: Yonghong>expcsv-q coffee sales statistics 1.sqry -d d:\ -p "market=East;type=Decaf" -fl ID>59 -r5

When the cmd.csv.file.row=500 is added in bi.properties, first quit startCMD.bat, and then restart it, the exported csv row can be controlled within 500 rows. 

Export into Database

When the user uses expdb, the user can check the parameter introduction only by input help expdb, as shown in the image:

clip1465

 

-q: the required specified option. The specified data set file. the data set file type should be supported by the system.

-c: the required designated option. Specify the Connection file, which could be parsed to a database connection.

-t: required designated option. Provide the table name, which Data Set data will export to.

-a: Optional option. Whether it is append mode or not, if it is not, delete the data in the table first, then insert the data set result.

-p: optional option. Provide the needed parameter by data set, for example: "parameter 1=value 1"; parameter 2=value 2". 

-fl: optional option. Specify the filter condition that adds to the data set. For example: "ID>20 and ID<100".

-url: required designated option. Specify database connection url, e.g. "jdbc:mysql://host:3306/test".

-db:: required designated option. Database types: Currently there are only four database types supported: mysql, oracle, essentially, and db2.

-dr: required designated option. Specify database driver, e.g. org.gjt.mm.mysql.Driver.

-usr: required designated option. Specify the username. 

-pwd: required designated option. Specify the password.  

-sch: optional option. Provide database schema.

-cat: optional option. Provide database catalog.

When export a database, there are two data source options:

Set data source via parameter -c.

Set data source via parameter -url, -db, -dr, -usr, -pwd, -sch and -cat.

Example 1: Yonghong>expdb -q t1.sqry -t "t1" -c mysql.conn -a-p "id=11;id=12" -fl "id=12". 

Example 2: Yonghong>expdb -q t1.sqry -db mysql -usr root -pwd yonghong4 -url "jdbc:mysql:// 192.168.1.104:3306/testdb" -p "Product_Type=Coffee" -fl "ID<2000 and ID>50" -t "t1" -dr "com.mysql.jdbc.Driver".

Export into Database

When the user uses expdb, the user can check the parameter introduction only by input help expdb, as shown in the image:

clip1466

-q: the required specified option. The specified data set file. the data set file type should be supported by the system.

-p: optional option. Provide the needed parameter by data set, for example: "parameter 1=value 1"; parameter 2=value 2". 

-d: required specified option. Specify the folder name, then the data set result will be saved in the folder of the name in the mart.

-f: required specified option. Specify the file name, then the data set result will be saved as the file name, for instance: file_name.zb.

-a: optional option. Whether it is append mode or not, if it is not, delete the data in the table first, then insert the data set result.  

-fl: optional option. Specify the filter condition that adds to the data set. For example: "ID>20 and ID<100".

-sc: optional option. Specify the column name for the mean splits of data set. The optional split column is type of number, date and time. This data set will be the specified number of data set by the specified split column. At the same time, execute these data sets to improve the effectiveness of importing data into MPP mart. 

-sn: optional option. State the split number for the data set.

For example: Yonghong>import -q t1.sqry -d "cloud1" -f "all" -sc ID -sn 2

This command means that importing data of data set t1 in data mart, and split equally by ID column. The split number of data set is 2, the name of folder in the mart is cloud 1, and the file name is all.zb. 

Exit

When the user uses quit, the user can check the parameter introduction only by input help quit, as shown in the image:

clip1467

This command directly exits Command Line.