Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tool-code
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ZGC_INDEX
tool-code
Commits
102318a3
Commit
102318a3
authored
Dec 07, 2021
by
rico.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sync condition
parent
859e6408
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
zgcindex_sync_excel2ob.py
数据治理平台线下处理/线下建库/zgcindex_sync_excel2ob.py
+23
-2
No files found.
数据治理平台线下处理/线下建库/zgcindex_sync_excel2ob.py
View file @
102318a3
...
...
@@ -9,7 +9,7 @@ Created on Mon Nov 22 22:38:22 2021
from
db
import
MYSQL
,
MSSQL
import
pandas
as
pd
path
=
"/Users/rico/WorkSpace/1_Project/Company/中电中采/TEMP Workspace/ES处理相关/ES线下补参处理/(已确认
)投影机结果202111241215280008
.xlsx"
path
=
"/Users/rico/WorkSpace/1_Project/Company/中电中采/TEMP Workspace/ES处理相关/ES线下补参处理/(已确认
202111261157470001)全渠道一体电脑2021-12-03 12_23_05数据
.xlsx"
df
=
pd
.
read_excel
(
path
,
converters
=
{
'FINISH_P_SKU'
:
str
})
try
:
export_df
=
df
[[
'DOC_ID'
,
'DATA_BATCH'
,
'DATA_END_TIME'
,
'FLOW_NODE_STATUS'
,
'SOURCE_P_SKU'
,
'SOURCE_CHANNEL_NAME'
,
'SOURCE_CHANNEL_SNAME'
,
'SOURCE_P_NAME'
,
...
...
@@ -20,7 +20,7 @@ except:
export_df
=
df
[[
'DOC_ID'
,
'DATA_BATCH'
,
'DATA_END_TIME'
,
'FLOW_NODE_STATUS'
,
'SOURCE_P_SKU'
,
'SOURCE_CHANNEL_NAME'
,
'SOURCE_CHANNEL_SNAME'
,
'SOURCE_P_NAME'
,
'SOURCE_P_LASTCATEGORY_NAME'
,
'SOURCE_P_BRAND_NAME'
,
'SOURCE_P_PRICE'
,
'SOURCE_P_URL'
,
'FINISH_P_REMARK'
,
'FINISH_P_BRAND_NAME'
,
'FINISH_P_BRAND_CODE'
,
'FINISH_P_LASTCATEGORY_NAME'
,
'FINISH_P_LASTCATEGORY_CODE'
,
'FINISH_P_PARAMS'
,
'FINISH_P_
NAME
'
,
'FINISH_P_LASTCATEGORY_CODE'
,
'FINISH_P_PARAMS'
,
'FINISH_P_
SKU'
,
'FINISH_P_NAME'
,
'FINISH_P_STATUS
'
,
'FINISH_P_CHECK_STATUS'
]]
...
...
@@ -40,6 +40,9 @@ try:
print
(
'>>> 插入数据成功,表 {} 共插入 {} 行数据'
.
format
(
tablename
,
len
(
export_df
)))
except
Exception
as
e
:
print
(
'>>> 插入数据失败'
,
e
)
'''
...
...
@@ -53,4 +56,21 @@ for index,row in df.iterrows():
brand = row['SOURCE_P_BRAND_NAME']
cursor.execute(f"update DW_PRODUCT_ALL_RES set SOURCE_P_LASTCATEGORY_NAME = '{name}', SOURCE_P_BRAND_NAME = '{brand}' where DOC_ID = '{doc_id}'")
temp_df= pd.read_excel("/Users/rico/WorkSpace/1_Project/Company/中电中采/TEMP Workspace/ES处理相关/ES线下补参处理/(已确认,蓝色为修改了品牌)笔记本结果202111241726340001.xlsx",converters = {'FINISH_P_SKU':str})
for index,row in temp_df.iterrows():
doc_id = row['DOC_ID']
FINISH_P_CHECK_STATUS = row['FINISH_P_CHECK_STATUS']
if FINISH_P_CHECK_STATUS == 'MATCHED':
print(index)
sku = row['FINISH_P_SKU']
cursor.execute(f"update DW_PRODUCT_ALL_RES set FINISH_P_SKU = '{sku}' where DOC_ID = '{doc_id}'")
'''
\ 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