2016-07-27 45 views
0

如何從hstore列屬性表dim_user中刪除敏感用戶信息。然後將其餘部分加載到聚合表中。我從PgSQL數據庫中選擇並使用Pentaho Data Integration將數據加載到聚合表中。解析hstore以刪除敏感信息 - PgSQL

attributes 
""DURATION"=>"1", "END_DATE"=>"2017-07-18", "START_DATE"=>"2016-07-18", "AUTO_RENEWAL"=>"true", "MEMBER_SINCE"=>"Mon Jul 18 14:31:01 EDT 2016", "DURATION_TYPE"=>"YEARS", "SHIPPING_ADDRESS"=>"1 Glos Cres, Toronto, ON Canada A9l 111", "SUBSCRIPTION_TYPE"=>"MY_ADVANTAGE"" 

需要從上面刪除「SHIPPING_ADDRESS」的值。

結果

""DURATION"=>"1", "END_DATE"=>"2017-07-18", "START_DATE"=>"2016-07-18", "AUTO_RENEWAL"=>"true", "MEMBER_SINCE"=>"Mon Jul 18 14:31:01 EDT 2016", "DURATION_TYPE"=>"YEARS", "SUBSCRIPTION_TYPE"=>"MY_ADVANTAGE" 

感謝。

回答

1

hstore功能和運營商是described in the hstore documentation。這相對簡單。

相反的:

SELECT cola, colb, colc FROM dim_user; 

你可以這樣做:

SELECT cola, colb, colc - 'SHIPPING_ADDRESS'::text FROM dim_user; 
0

刪除它,而選擇:

select attributes - 'SIHPPING_ADDRESS' as attributes, 
     ... other columns ... 
from dim_user; 

或創建做了這樣的觀點,然後從釜視圖中選擇。