Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
jd_data_process
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ccae3bc9
authored
Sep 29, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add new file
parent
2bfcc981
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
move_copy_to_db.py
update_jd_attr.py
move_copy_to_db.py
0 → 100644
View file @
ccae3bc9
import
pymysql
# 主要用于将copy表移动到原表。
if
__name__
==
'__main__'
:
db
=
pymysql
.
connect
(
host
=
'192.168.1.238'
,
port
=
3306
,
user
=
'liexin_data_distribution'
,
password
=
'liexin_data_distribution#zsyM'
,
database
=
'liexin_data_distribution'
)
query_sql
=
"select id, class_id, attr_id, attr_name, unit, is_enum, enum_value, input_type, is_required, status, platform, create_time, update_time from lie_shop_attr_copy1"
cursor
=
db
.
cursor
()
cursor
.
execute
(
query
=
query_sql
)
results
=
cursor
.
fetchall
()
for
i
in
range
(
len
(
results
)):
id
=
results
[
i
][
0
]
class_id
=
results
[
i
][
1
]
attr_id
=
results
[
i
][
2
]
attr_name
=
results
[
i
][
3
]
unit
=
results
[
i
][
4
]
is_enum
=
results
[
i
][
5
]
enum_value
=
results
[
i
][
6
]
input_type
=
results
[
i
][
7
]
is_required
=
results
[
i
][
8
]
status
=
results
[
i
][
9
]
platform
=
results
[
i
][
10
]
create_time
=
results
[
i
][
11
]
update_time
=
results
[
i
][
12
]
insert_sql
=
"insert into lie_shop_attr (id, class_id, attr_id, attr_name, unit, is_enum, enum_value, input_type, is_required, status, platform, create_time, update_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
cursor
.
execute
(
insert_sql
,
args
=
(
id
,
class_id
,
attr_id
,
attr_name
,
unit
,
is_enum
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,
update_time
,))
db
.
commit
()
print
(
insert_sql
%
(
id
,
class_id
,
attr_id
,
attr_name
,
unit
,
is_enum
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,
update_time
))
\ No newline at end of file
update_jd_attr.py
View file @
ccae3bc9
...
@@ -30,7 +30,7 @@ def update_attr(class_id: int):
...
@@ -30,7 +30,7 @@ def update_attr(class_id: int):
app_secret
=
app_secret
,
app_secret
=
app_secret
,
param
=
{
"category_leaf_id"
:
class_id
}
param
=
{
"category_leaf_id"
:
class_id
}
)
)
print
(
json
.
dumps
(
data
,
ensure_ascii
=
False
))
...
@@ -45,9 +45,10 @@ def update_ext_attr(class_id: int):
...
@@ -45,9 +45,10 @@ def update_ext_attr(class_id: int):
app_secret
=
app_secret
,
app_secret
=
app_secret
,
param
=
{
"category_leaf_id"
:
class_id
}
param
=
{
"category_leaf_id"
:
class_id
}
)
)
print
(
json
.
dumps
(
data
,
ensure_ascii
=
False
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
pass
update_attr
(
33529
)
\ No newline at end of file
\ 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