Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AppTag
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
AppTag
Commits
f0cb56fc
Commit
f0cb56fc
authored
Dec 05, 2018
by
wangjf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
09b54552
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
13 deletions
+28
-13
mysql2hive.sh
azkaban/mysql2hive.sh
+28
-13
No files found.
azkaban/mysql2hive.sh
View file @
f0cb56fc
#!/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
\
--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
# USE dev;
# CREATE EXTERNAL TABLE app_tag(
# package_name string,
# app_name string,
# platform string,
# category string
# ) ROW FORMAT DELIMITED
# FIELDS TERMINATED BY '\001'
# STORED AS TEXTFILE
# LOCATION 's3://mob-emr-test/wangjf/data/dwh/app_tag';
\ No newline at end of file
base_dir
=
"s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/dim_package_tags"
sql
=
"INSERT OVERWRITE DIRECTORY '
${
base_dir
}
/
${
date_path
}
'
SELECT a.package_name,a.platform,b.tag_type,b.first_tag,b.second_tag,b.comment_cn
FROM (SELECT package_name,lower(platform) platform,feat_id
FROM dev.app_tag_tmp
LATERAL VIEW EXPLODE(SPLIT(REGEXP_REPLACE(REGEXP_REPLACE(SUBSTRING(category,2,LENGTH(category) - 2),'
\"
',''),' ',''),',')) featTable AS feat_id) a
INNER JOIN dwh.dm_old2new_tag b ON a.feat_id = b.new_second_id
UNION ALL
SELECT package_name,platform,tag_type,first_tag,second_tag,comment
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment