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
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 ;
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
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);
2. Overall schematic diagram
2.1 Table input
2.2 row to column
2.3 Field selection
2.4 Text file output