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
ff83e25d
authored
Oct 14, 2024
by
larosa
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add update
parent
489de7fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
update_jd_attr.py
update_jd_attr.py
View file @
ff83e25d
...
@@ -217,17 +217,17 @@ def update_ext_attr_by_class_ids(conf: dict):
...
@@ -217,17 +217,17 @@ def update_ext_attr_by_class_ids(conf: dict):
print
(
"暂时未兼容此种类型的拓展属性 input_type: "
+
str
(
input_type
))
print
(
"暂时未兼容此种类型的拓展属性 input_type: "
+
str
(
input_type
))
# 检查此分类的此拓展属性在 db 中是否已存在,未存在则 insert, 存在则 update
# 检查此分类的此拓展属性在 db 中是否已存在,未存在则 insert, 存在则 update
#
check_sql = "select id from lie_shop_attr where class_id = %s and attr_id = %s"
check_sql
=
"select id from lie_shop_attr where class_id =
%
s and attr_id =
%
s"
#
cursor.execute(query=check_sql, args=(class_id, attr_id,))
cursor
.
execute
(
query
=
check_sql
,
args
=
(
class_id
,
attr_id
,))
#
db_result = cursor.fetchall()
db_result
=
cursor
.
fetchall
()
#
if len(db_result) == 0:
if
len
(
db_result
)
==
0
:
#
# 不存在时
# 不存在时
#
insert_sql = "insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
insert_sql
=
"insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
#
cursor.execute(query=insert_sql, args=(class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time,))
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,))
#
db.commit()
db
.
commit
()
#
print(insert_sql % (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time))
print
(
insert_sql
%
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
))
#
else:
else
:
#
update_sql = ""
update_sql
=
""
insert_ext_attr_to_redis
(
class_attr_mapping
,
conf
)
insert_ext_attr_to_redis
(
class_attr_mapping
,
conf
)
...
...
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