-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipa_deletion2.sh
31 lines (21 loc) · 1.37 KB
/
pipa_deletion2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
echo "##################################################################"
echo "################## PII DELETION PROCESS START ####################"
echo "##################################################################"
today=$(date "+%Y%m%d%H%M%S")
echo "################## right now!! : ${today}"
target_table=( "application_train" "credit_card_balance" "installments_payments" "pos_cash_balance" "previous_application" "bureau")
#target_table=( "credit_card_balance" )
for target_table in ${target_table[@]}; do
echo "################## Target Table Name : ${target_table}"
var=`hive -e "select count(*) from standardization.${target_table} where sk_id_curr in (select id from standardization.pii_list)"`
if [ "${var}" = 0 ]; then
echo "################## standardization.${target_table} - No deletion target data existed"
else
echo "################## standardization.${target_table} - Deletion in progress"
hive -e "delete from standardization.${target_table} where sk_id_curr in (select id from standardization.pii_list)"
echo "################## standardization.${target_table} - Deletion completed"
fi
done
echo "##################################################################"
echo "################## PII DELETION PROCESS END ######################"
echo "##################################################################"