pentaho DI--- Tutorial (spoon)
Pentaho Data Integration (PDI, also called Kettle),是pentaho的etl工具.雖然etl工具一般都用在數(shù)據(jù)倉(cāng)庫(kù)環(huán)境中,可是,PDI還是可以做以下事情:
1)在數(shù)據(jù)庫(kù)或應(yīng)用系統(tǒng)間遷移數(shù)據(jù).
2)把數(shù)據(jù)導(dǎo)成為檢系統(tǒng)
3)大數(shù)據(jù)的批量倒入數(shù)據(jù)庫(kù)。
4)系統(tǒng)整合。
5)數(shù)據(jù)清洗。
PDI的使用非常簡(jiǎn)單,每一步基本上都可以聽過(guò)圖形化的工具來(lái)完成,而不需要寫代碼。從這個(gè)意義上說(shuō),PDI是面向元數(shù)據(jù)的。
PDI既可以作為一個(gè)單獨(dú)工具使用,也可以作為pentaho的整個(gè)軟件包的一部分使用。作為一個(gè)單獨(dú)的工具,PDI支持各種數(shù)據(jù)源的輸入和輸出,包括:
文本文件;數(shù)據(jù)表;各種商業(yè)化的數(shù)據(jù)庫(kù)引擎。PDI允許你對(duì)數(shù)據(jù)進(jìn)行各種精細(xì)的控制。
現(xiàn)在,我們通過(guò)傳統(tǒng)的“Hello world”的例子,來(lái)展示使用PDI是多么的簡(jiǎn)單。
1)下載PDI;
2)spoon的簡(jiǎn)介:
spoon是一個(gè)圖形化的工具,用來(lái)設(shè)計(jì)和測(cè)試PDI要使用的過(guò)程等。設(shè)計(jì)測(cè)試完畢后,可以在終端窗口運(yùn)行。
In Spoon, you build Jobs and Transformations. PDI offers two methods to save them:
3)例子
?a)源數(shù)據(jù)是一個(gè)csv文件,內(nèi)容如下:
??? last_name, name
Suarez,Maria
Guimaraes,Joao
Rush,Jennifer
Ortiz,Camila
Rodriguez,Carmen
da Silva,Zoe
b)經(jīng)過(guò)轉(zhuǎn)換后,變?yōu)閤ml文件,期望值如下:
- <Rows>
? - <row>
??????? <msg>Hello, Maria!</msg>
??? </row>
? - <row>
??????? <msg>Hello, Joao!</msg>
??? </row>
? - <row>
??????? <msg>Hello, Jennifer!</msg>
??? </row>
? - <row>
??????? <msg>Hello, Camila!</msg>
??? </row>
? - <row>
??????? <msg>Hello, Carmen!</msg>
??? </row>
? - <row>
??????? <msg>Hello, Zoe!</msg>
??? </row>
? </Rows>
下面是具體操作:
?第一步:菜單選擇:文件--〉新建--〉轉(zhuǎn)換
第二步:設(shè)置。對(duì)轉(zhuǎn)換過(guò)程進(jìn)行設(shè)置。如上圖。
命名并保存。
使用?Steps and Hops構(gòu)建轉(zhuǎn)換的骨架。
? 在轉(zhuǎn)換里面:step是最小的單元步驟。step的種類非常繁多,基本上,可以歸納成幾類,比如input和output,還有其他歸類。每一個(gè)step都認(rèn)為是
完成一個(gè)工作,比如恢復(fù)數(shù)據(jù)集合等。
而hop,是在兩個(gè)step之間數(shù)據(jù)轉(zhuǎn)換流動(dòng)的圖示。包含數(shù)據(jù)的起始和傳遞方向。
我們這次轉(zhuǎn)換例子,包含三個(gè)步驟:
1)讀取csv文件。
2)加入問(wèn)候語(yǔ)句。
3)存成xml文件。
- To the left of the workspace is the Steps Palette. Select the Input category.
- Drag the CSV file onto the workspace on the right.
- Select the Scripting category.
- Drag the Modified JavaScript Value icon to the workspace.
- Select the Output category.
- Drag the XML Output icon to the workspace.
?
下面,選擇第一個(gè)step,按住shift鍵,拖到第二個(gè)step上。
同樣操作第二個(gè)到第三個(gè)。
現(xiàn)在,配置第一個(gè)step,雙擊它。可以看到:
這里還有2個(gè)步驟:get fields,和preview。
?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/aomi/archive/2013/05/16/3082505.html
總結(jié)
以上是生活随笔為你收集整理的pentaho DI--- Tutorial (spoon)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: android cocos2dx pdf
- 下一篇: 谈谈即时通讯开发平台