ETL DataStage實現V14

and parallel oriented functions.
7) DataStage server executed by dataStage server environment but parallel executed under control of dataStage runtime environment
8) DataStage compiled in to BASIC(interpreted pseudo code) and Parallel compiled to OSH(Orchestrate Scripting Language).
9) Debugging and Testing Stages are available only in the Parallel Extender.
10) More Processing Stages are not included in Server example, Join, CDC, Lookup etc…..
11) In File Stages, Hash file available only in Server and Complex falat file , dataset , lookup file set avail in parallel only.
12) Server Transformer supports basic transforms only, but in parallel both basic and parallel transforms.
13) Server transformer is basic language compatability, pararllel transformer is c++ language compatabillity
14) Look up of sequntial file is possible in parallel Jobs
15) . In parallel we can specify more file paths to fetch data from using file pattern similar to Folder Stage in Server, while in server we can specify one file name in one O/P link.
16). We can simulteneously give input as well as output link to a seq. file Stage in Server. But an output link in parallel means a reject link, that is a link that collects records that fail to load into the sequential file for some reasons.
17). The difference is file size Restriction. Sequential file size in server is : 2GB; Sequential file size in parallel is : No Limitation.
18). Parallel sequential file has filter options too. Where you can specify the file pattern.

除此之外,還有很多細節是相差很大的,做時需要注意。使用時很簡單的感覺,Server Job可以很容易的上手,開發也很快,性能就差一些(就像MySQL)Parallel Job要求很嚴格,掌握起來有點難,但性能很強勁(就像DB2)

4.4    JOB和Stage

Server JobParalel Job都是利用各種不同功能的Stage的組合,實現具體的E T L功能,而Job Sequence則是將Server Job或者Parallel Job或者Job Sequence連接起來,實現Job間的依賴等。JOB中用到的參數,在DS Administrator中定義的,可以直接引用,在參數文件或者參數表中定義的,就得用程序調用賦給相應的JOB了。

數據倉庫中用到的事實表,維表,緩慢變化維,增量,全量等等概念,在DS中沒有直接對應的Stage,和用SQL一樣,需要我們編程實現相應的邏輯。

下面兩個示例,實現的功能都是一樣的,都是從文本文件中讀取數據,進行簡單的字段類型轉換後,入庫。只不過是Parallel Job是入DB2Server Job是入Oracle

4.4.1    Parallel Job和Stage

一般我們創建一個Job,大概都是如下的樣子。和寫程序實現一樣,我們需要知道源和目標是什麼,中間做什麼處理,然後實現之。用DS也是一樣,只是將不同的Stage組合起來,實現相應的功能。JobStage中還有很多其他的東西,只是用了最經常用的功能和Stage進行示例。

這個Job就是先將同一周期的數據刪掉,然後從Sequential File Stage中按照定義的接口規範讀取數據,在Transformer Stage中對字段進行轉換,最後在DB2 Stage中將其入庫。


其他複雜的Job也大概是這樣,也都是按照實現的功能,將不同的Stage組合起來。

Job中用到的參數都是在Job Properties中定義的,另外一些通用的功能(執行前對一些文件的處理)也是在這裡實現的



Parallel JobServer Job這方面基本上是一樣的。接下來,就按照順序一個一個Stage大概說一下。先看一下Sequential File Stage



配置好文件路徑和其他參數後,就View Data一下,好多錯誤都是因為配置不對引起的。文本文件的操作,都是用Sequential File Stage。對於中間用到的文件,可以用Data Set Stage,這個是DS內部實現的,性能很好。

讀到數據後,就用Transformer執行類型轉換、源和目標的字段映射等。ETL中用到的源和目標字段的對應關係,都是通過Active Stage以”拉線”的方式實現的。沒有辦法在參數表中定義好,在此引用。倒是可以用文檔記錄不同的源和目標之間的映射關係。整個E T L,也都是用Passive 讀到數據後,用不同的Active Stage組合,實現關聯、去重、轉換等。


其中字段LAST_UPD_TIMECYCLE_TIME是我們在ETL中用到的,LAST_UPD_TIME表示這批數據的實際入庫時間,CYCLE_TIME表示這一批數據的數據時間,當然根據項目需要,可以添加其他的字段來標示。對於增量的Job,每次執行前都是先將同一CYCLE_TIME的數據刪掉,然後入庫,這樣做就是為了支持重做。對於全量JOB,都是將表中的數據Truncate掉,然後入庫。

處理完後,就可以入庫了

以下文章點擊率最高

Loading…

     

如果這文章對你有幫助,請掃左上角微信支付-支付寶,給於打賞,以助博客運營