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
a26a500c
Commit
a26a500c
authored
Feb 09, 2026
by
fangxingjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
8a9da898
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
ods_bs_category_asin_detail.py
Pyspark_job/sqoop_import/ods_bs_category_asin_detail.py
+3
-0
ods_keepa_finder_asin.py
Pyspark_job/sqoop_import/ods_keepa_finder_asin.py
+19
-6
No files found.
Pyspark_job/sqoop_import/ods_bs_category_asin_detail.py
View file @
a26a500c
...
...
@@ -18,6 +18,9 @@ if __name__ == '__main__':
d2
=
f
'0{d2}'
if
int
(
d2
)
<
10
else
f
'{d2}'
db_type
=
'postgresql_14'
import_tb
=
f
"{site_name}_bs_category_asin_detail_month_{d1}_{d2}"
if
date_type
==
'day'
:
import_tb
=
f
"{site_name}_bs_category_asin_detail_day_{date_info.replace('-', '_')}"
query
=
f
"""
select
id, asin, null as week, best_sellers_rank, created_time as created_at, updated_time as updated_at, last_herf, all_best_sellers_href
...
...
Pyspark_job/sqoop_import/ods_keepa_finder_asin.py
View file @
a26a500c
...
...
@@ -4,6 +4,13 @@ import sys
sys
.
path
.
append
(
os
.
path
.
dirname
(
sys
.
path
[
0
]))
from
utils.secure_db_client
import
get_remote_engine
from
datetime
import
datetime
,
timedelta
def
is_saturday
(
date_str
:
str
,
fmt
:
str
=
"
%
Y-
%
m-
%
d"
)
->
bool
:
dt
=
datetime
.
strptime
(
date_str
,
fmt
)
# weekday(): 周一=0 ... 周六=5 周日=6
return
dt
.
weekday
()
==
5
site_name
=
sys
.
argv
[
1
]
# 参数1:站点
date_type
=
sys
.
argv
[
2
]
# 参数2:类型:day/week/4_week/month/quarter
...
...
@@ -24,12 +31,18 @@ partition_dict = {
}
sql_query
=
f
"select id, request_id, asin, tracking_since from keepa_finder_asin where 1=1 "
\
f
"and
\
$CONDITIONS"
engine
.
sqoop_raw_import
(
query
=
sql_query
,
hive_table
=
hive_table
,
partitions
=
partition_dict
,
m
=
1
,
)
is_saturday_flag
=
is_saturday
(
date_info
)
if
is_saturday_flag
:
print
(
f
"{date_info}是周六, 因此需要进行导入"
)
engine
.
sqoop_raw_import
(
query
=
sql_query
,
hive_table
=
hive_table
,
partitions
=
partition_dict
,
m
=
1
,
)
else
:
print
(
f
"{date_info}不是周六, 因此不需要进行导入"
)
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