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
5efdfc6e
Commit
5efdfc6e
authored
May 25, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
利润率导出pg
parent
415179d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
export_need_profit_rate.py
Pyspark_job/script/export_need_profit_rate.py
+8
-2
No files found.
Pyspark_job/script/export_need_profit_rate.py
View file @
5efdfc6e
...
@@ -87,15 +87,21 @@ class ExportNeedProfitRate(object):
...
@@ -87,15 +87,21 @@ class ExportNeedProfitRate(object):
# 5. keepa 当日增量 INNER JOIN
# 5. keepa 当日增量 INNER JOIN
# keepa 表已整合为单分区快照,用 updated_time > last_date_info 筛"近一天更新"的增量
# keepa 表已整合为单分区快照,用 updated_time > last_date_info 筛"近一天更新"的增量
# weight 取数规则:优先 item_weight;item_weight <= 0 时用 package_weight 兜底;都不大于 0 → 过滤
sql_keepa
=
f
"""
sql_keepa
=
f
"""
SELECT asin, package_length, package_width, package_height, item_weight AS weight
SELECT asin, package_length, package_width, package_height,
CASE WHEN item_weight > 0 THEN item_weight
WHEN package_weight > 0 THEN package_weight
ELSE NULL
END AS weight
FROM dim_keepa_asin_info
FROM dim_keepa_asin_info
WHERE site_name = '{self.site_name}' AND updated_time >= '{self.last_date_info}'
WHERE site_name = '{self.site_name}' AND updated_time >= '{self.last_date_info}'
"""
"""
df_keepa
=
self
.
spark
.
sql
(
sqlQuery
=
sql_keepa
)
\
df_keepa
=
self
.
spark
.
sql
(
sqlQuery
=
sql_keepa
)
\
.
filter
((
F
.
col
(
'package_length'
)
>
0
)
&
.
filter
((
F
.
col
(
'package_length'
)
>
0
)
&
(
F
.
col
(
'package_width'
)
>
0
)
&
(
F
.
col
(
'package_width'
)
>
0
)
&
(
F
.
col
(
'package_height'
)
>
0
))
\
(
F
.
col
(
'package_height'
)
>
0
)
&
(
F
.
col
(
'weight'
)
>
0
))
\
.
repartition
(
40
,
'asin'
)
.
repartition
(
40
,
'asin'
)
df_result
=
df_flow
\
df_result
=
df_flow
\
...
...
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