Kettle row and column conversion

Reference: http://blog.itpub.net/29254281/viewspace-1271742/ 

Kettle is an open source ETL tool

 

Rows and columns are no strangers 

http://blog.itpub.net/29254281/viewspace-775660/

 

 

Kettle has a row-column conversion function in the control, but the row-column conversion seems to be reversed.

1. Line to column

1. Database script

copy code
create TABLE StudentInfo
(
    studentno int,
    subject varchar(10),
    grade int 
);
insert into StudentInfo values(201105545,'语文',80); insert into StudentInfo values(201105545,'数学',82); insert into StudentInfo values(201105545,'英语',84); insert into StudentInfo values(201105543,'Chinese ' , 70 ); insert into StudentInfo values ​​( 201105543 , ' Math ' , 74 ); insert into StudentInfo values ​​( 201105543 , ' English ' , 76 ); insert into StudentInfo values ​​( 201105548 , ' Chinese ' , 90 ); insert into StudentInfo values ​​( 201105548, ' Math ' , 93 ); insert into StudentInfo values ​​( 201105548 , ' English ' , 94 ); commit ;
copy code

2. Overall row-to-column diagram

2.1 Table input configuration

2.2 Column-to-row configuration

 

2.3 Field selection configuration

2.4 Text file output configuration

View content after output to file

2. Column transfer

1. Database script

copy code
CREATE TABLE StudentInfo_TMP(studentno INT,Chinese INT,Math INT,English int);

INSERT INTO StudentInfo_TMP VALUES(201105543,70,74,76);

INSERT INTO StudentInfo_TMP VALUES(201105545,80,82,84);

INSERT INTO StudentInfo_TMP VALUES(201105548,90,93,94);
copy code

2. Overall schematic diagram

2.1 Table input

2.2 row to column

 

2.3 Field selection

2.4 Text file output

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326489016&siteId=291194637