Commit f0cb56fc by wangjf

fix

parent 09b54552
#!/usr/sh #!/usr/sh
DT=$(date +%Y%m%d -d "-1 day $ScheduleTime")
today=${ScheduleTime:-$1}
date_path=$(date +%Y/%m/%d -d "-1 day $today")
# sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" --connect jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag \
# --username apptag_rw --password 7gyLEVtkER3u8c9 --table tag_result --columns 'package_name,app_name,platform,feat_id' -m 1 --null-string '\\N' --null-non-string '\\N' \
# --target-dir 's3://mob-emr-test/wangjf/data/dwh/app_tag' --fields-terminated-by '\001' --delete-target-dir
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" --connect jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag \ sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" --connect jdbc:mysql://dataplatform-app-tag.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306/app_tag \
--username apptag_rw --password 7gyLEVtkER3u8c9 --table tag_result --columns 'package_name,app_name,platform,feat_id' -m 1 --null-string '\\N' --null-non-string '\\N' \ --username apptag_rw --password 7gyLEVtkER3u8c9 --query 'select package_name,app_name,lower(platform),json_keys(feat_id) from tag_result where $CONDITIONS and feat_id is not null' -m 1 --null-string '\\N' --null-non-string '\\N' \
--target-dir 's3://mob-emr-test/wangjf/data/dwh/app_tag' --fields-terminated-by '\001' --delete-target-dir --target-dir 's3://mob-emr-test/wangjf/data/dwh/app_tag' --fields-terminated-by '\001' --delete-target-dir
# USE dev; base_dir="s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/dim_package_tags"
# CREATE EXTERNAL TABLE app_tag(
# package_name string, sql="INSERT OVERWRITE DIRECTORY '${base_dir}/${date_path}'
# app_name string, SELECT a.package_name,a.platform,b.tag_type,b.first_tag,b.second_tag,b.comment_cn
# platform string, FROM (SELECT package_name,lower(platform) platform,feat_id
# category string FROM dev.app_tag_tmp
# ) ROW FORMAT DELIMITED LATERAL VIEW EXPLODE(SPLIT(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING(category,2,LENGTH(category) - 2),'\"',''),' ',''),',')) featTable AS feat_id) a
# FIELDS TERMINATED BY '\001' INNER JOIN dwh.dm_old2new_tag b ON a.feat_id = b.new_second_id
# STORED AS TEXTFILE UNION ALL
# LOCATION 's3://mob-emr-test/wangjf/data/dwh/app_tag'; SELECT package_name,platform,tag_type,first_tag,second_tag,comment
\ No newline at end of file FROM dwh.dim_package_tags
"
hive -e "${sql}"
if [ $? -ne 0 ]; then
exit 255
fi
hive -e "use dwh;alter table dim_package_tags set location '${base_dir}/${date_path}';"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment