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
a8571acd
Commit
a8571acd
authored
Sep 28, 2026
by
hejiangming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
年度搜索词增加创表判断
parent
e9f81eb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
dwt_aba_last365.py
Pyspark_job/sqoop_export/dwt_aba_last365.py
+11
-0
No files found.
Pyspark_job/sqoop_export/dwt_aba_last365.py
View file @
a8571acd
...
@@ -36,6 +36,17 @@ if __name__ == '__main__':
...
@@ -36,6 +36,17 @@ if __name__ == '__main__':
export_tb_rel
=
f
"{export_tb_before}_copy"
export_tb_rel
=
f
"{export_tb_before}_copy"
engine
=
DBUtil
.
get_db_engine
(
db_type
,
site_name
)
engine
=
DBUtil
.
get_db_engine
(
db_type
,
site_name
)
# 年表每年一张:当年正式表不存在时(新一年首次导出),按上一年年表结构新建
if
date_type
==
DateTypes
.
year
.
name
:
last_year_tb
=
f
"{site_name}_aba_last_year_{int(year) - 1}"
with
engine
.
connect
()
as
connection
:
exist
=
connection
.
execute
(
f
"select to_regclass('{export_tb_before}')"
)
.
scalar
()
if
exist
is
None
:
sql
=
f
"create table {export_tb_before} (like {last_year_tb} including all);"
print
(
"================================当年年表不存在,复制上一年表结构================================"
)
print
(
sql
)
connection
.
execute
(
sql
)
# 创建备份表
# 创建备份表
with
engine
.
connect
()
as
connection
:
with
engine
.
connect
()
as
connection
:
sql
=
f
"""
sql
=
f
"""
...
...
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