2017-10-17 226 views
0

我有一個表result_slalom,其中數據通過Pentaho的ETL作業填充。 當ETL第一次運行時,它會創建版本-1。我應該如何控制使用Pentaho的計算版本的重複?

現在,如果數據在新計算後發生變化,它將成爲版本-2。

我只需要在計算版本-2中進行更改,並且在result_slalom表中不應超過2個版本。 (版本1和版本2)

所以邏輯是: 檢查表存在

Ø

When data exists and existing version is 1, then set the version of new data=2 
--> Insert new dataset 
o When data exists and existing version is 2, then set the version of new data=2 
--> Update existing dataset 
o When no data exists, then set version = 1 
--> Insert new dataset 

如何讓我的Pentaho的公式來進行邏輯數據?

目前它是:

if([VersionInDB]=1;[Calculationversion];[VersionInDB]+1) 

回答

0

dimension lookup/update是一個步驟,它正是如此。

此外,它具有有效日期:在創建版本2時,版本1接收現在的結束日期,版本2接收現在的開始日期。使用date between start-date and end-date可以輕鬆檢索歷史信息。另外,您有一個按鈕可以爲您編寫create/alter tablecreate index

另一個很好的解決方案是在表格上放置一個觸發器。

忘記在這個方向重新發明車輪。儘管我通常喜歡發明輪子,但重新開發邏輯會導致您無數次的測試和錯誤。

相關問題