Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
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
abel_cjy
Amazon-Selection-Data
Commits
2d09090f
Commit
2d09090f
authored
Feb 09, 2026
by
fangxingjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
a26a500c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
dwd_nsr_bsr_keepa_asin.py
Pyspark_job/dwd/dwd_nsr_bsr_keepa_asin.py
+4
-1
dwd_nsr_bsr_keepa_asin.py
Pyspark_job/sqoop_export/dwd_nsr_bsr_keepa_asin.py
+8
-4
No files found.
Pyspark_job/dwd/dwd_nsr_bsr_keepa_asin.py
View file @
2d09090f
...
@@ -120,12 +120,15 @@ class DwdNsrBsrKeepaAsin(Templates):
...
@@ -120,12 +120,15 @@ class DwdNsrBsrKeepaAsin(Templates):
df_nsr_agg
,
on
=
[
'asin'
],
how
=
'left'
df_nsr_agg
,
on
=
[
'asin'
],
how
=
'left'
)
)
self
.
df_save_asin_cate
=
self
.
df_save_asin_cate
.
withColumn
(
"site_name"
,
F
.
lit
(
self
.
site_name
))
self
.
df_save_asin_cate
=
self
.
df_save_asin_cate
.
withColumn
(
"site_name"
,
F
.
lit
(
self
.
site_name
))
self
.
df_save_asin_cate
=
self
.
df_save_asin_cate
.
withColumn
(
"date_type"
,
F
.
lit
(
self
.
date_type
))
self
.
df_save_asin_cate
=
self
.
df_save_asin_cate
.
withColumn
(
"date_info"
,
F
.
lit
(
self
.
date_info
))
self
.
df_save_asin_cate
.
show
(
10
,
truncate
=
False
)
self
.
df_save_asin_cate
.
show
(
10
,
truncate
=
False
)
self
.
save_data_common
(
self
.
save_data_common
(
df_save
=
self
.
df_save_asin_cate
,
df_save
=
self
.
df_save_asin_cate
,
db_save
=
self
.
db_save_cate
,
db_save
=
self
.
db_save_cate
,
partitions_num
=
self
.
partitions_num
,
partitions_num
=
self
.
partitions_num
,
partitions_by
=
[
"site_name"
]
partitions_by
=
self
.
partitions_by
,
# partitions_by=["site_name"],
)
)
# self.df_save_asin_cate = self.df_save_asin_cate.withColumn("date_type", F.lit(self.date_type))
# self.df_save_asin_cate = self.df_save_asin_cate.withColumn("date_type", F.lit(self.date_type))
# self.df_save_asin_cate = self.df_save_asin_cate.withColumn("date_info", F.lit(self.date_info))
# self.df_save_asin_cate = self.df_save_asin_cate.withColumn("date_info", F.lit(self.date_info))
...
...
Pyspark_job/sqoop_export/dwd_nsr_bsr_keepa_asin.py
View file @
2d09090f
...
@@ -9,9 +9,10 @@ engine = get_remote_engine(
...
@@ -9,9 +9,10 @@ engine = get_remote_engine(
db_type
=
"postgresql_14"
,
# -> 服务端 alias "mysql"
db_type
=
"postgresql_14"
,
# -> 服务端 alias "mysql"
)
)
site_name
=
'us'
site_name
=
sys
.
argv
[
1
]
# 参数1:站点
date_type
=
'day'
date_type
=
sys
.
argv
[
2
]
# 参数2:类型:day/week/4_week/month/quarter
date_info
=
'2026-02-04'
date_info
=
sys
.
argv
[
3
]
# 参数3:年-月-日/年-周/年-月/年-季, 比如: 2022-1
partitions
=
{
partitions
=
{
'site_name'
:
site_name
,
'site_name'
:
site_name
,
'date_type'
:
date_type
,
'date_type'
:
date_type
,
...
@@ -19,9 +20,12 @@ partitions = {
...
@@ -19,9 +20,12 @@ partitions = {
}
}
cols_list
=
[
'asin'
,
'asin_cate_flag'
,
'date_info'
]
cols_list
=
[
'asin'
,
'asin_cate_flag'
,
'date_info'
]
import_table
=
f
'{site_name}_all_syn_st_day_{date_info.replace("-", "_")}'
engine
.
execute
(
f
"truncate {import_table};"
)
print
(
f
"清空对应的pg14-asin导出表: {import_table}"
)
engine
.
sqoop_raw_export
(
engine
.
sqoop_raw_export
(
hive_table
=
'dwd_nsr_bsr_keepa_asin'
,
hive_table
=
'dwd_nsr_bsr_keepa_asin'
,
import_table
=
f
'{site_name}_all_syn_st_day_{date_info.replace("-", "_")}'
,
import_table
=
import_table
,
partitions
=
partitions
,
partitions
=
partitions
,
m
=
1
,
m
=
1
,
cols
=
','
.
join
(
cols_list
)
cols
=
','
.
join
(
cols_list
)
...
...
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