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
8be6d717
authored
Nov 13, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add fix py
parent
3fafb1aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
19 deletions
fix.py
tmp.sql
fix.py
View file @
8be6d717
...
@@ -33,20 +33,32 @@ config_prod = {
...
@@ -33,20 +33,32 @@ config_prod = {
"""
"""
为新增列 sku_sn字段赋值,当前为platform = 1的数据,sku_sn为 sku_id字段的字符串形式。
为新增列 sku_sn字段赋值,当前为platform = 1的数据,sku_sn为 sku_id字段的字符串形式。
"""
"""
# def main(conf: dict):
# host = conf["mysql"]["host"]
# port = conf["mysql"]["port"]
def
main
(
conf
:
dict
):
# user = conf["mysql"]["user"]
host
=
conf
[
"mysql"
][
"host"
]
# password = conf["mysql"]["password"]
port
=
conf
[
"mysql"
][
"port"
]
# database = conf["mysql"]["database"]
user
=
conf
[
"mysql"
][
"user"
]
# db = pymysql.connect(host=host, port=port, user=user, password=password, database=database)
password
=
conf
[
"mysql"
][
"password"
]
# cursor = db.cursor()
database
=
conf
[
"mysql"
][
"database"
]
# sql = "select id, sku_id from lie_shop_push_sku_log where id >= %d order by id asc limit 5000"
db
=
pymysql
.
connect
(
host
=
host
,
port
=
port
,
user
=
user
,
password
=
password
,
database
=
database
)
# index = 1
cursor
=
db
.
cursor
()
# while (index <= 499813):
sql
=
"select id, sku_id from lie_shop_push_sku_log where id >=
%
s and platform = 1 order by id asc limit 5000"
#
index
=
1
#
max_id
=
549690
#
while
index
<=
max_id
:
#
cursor
.
execute
(
query
=
sql
,
args
=
(
index
,))
#
results
=
cursor
.
fetchall
()
# if __name__ == '__main__':
for
i
in
range
(
len
(
results
)):
id
=
results
[
i
][
0
]
sku_id
=
results
[
i
][
1
]
sku_sn
=
str
(
sku_id
)
update_sql
=
"update lie_shop_push_sku_log set sku_sn =
%
s where id =
%
s"
cursor
.
execute
(
query
=
update_sql
,
args
=
(
sku_sn
,
id
,))
db
.
commit
()
print
(
update_sql
%
(
sku_sn
,
id
))
index
=
index
+
5000
if
__name__
==
'__main__'
:
main
(
config_dev
)
tmp.sql
View file @
8be6d717
...
@@ -36,4 +36,8 @@ update lie_shop_push_sku_log set audit_status = 1 where create_time > 1730368800
...
@@ -36,4 +36,8 @@ update lie_shop_push_sku_log set audit_status = 1 where create_time > 1730368800
create
index
sku_id_platform_index
on
lie_shop_push_sku_log
(
sku_id
,
platform
);
create
index
sku_id_platform_index
on
lie_shop_push_sku_log
(
sku_id
,
platform
);
alter
table
lie_shop_push_sku_log
add
column
sku_sn
varchar
(
64
)
default
''
not
null
comment
'sku推送唯一编码'
after
sku_id
;
alter
table
lie_shop_push_sku_log
add
column
sku_sn
varchar
(
64
)
default
''
not
null
comment
'sku推送唯一编码'
after
sku_id
;
\ No newline at end of file
update
lie_shop_picture
set
jd_pdf
=
''
where
lie_pdf
like
'%.html%'
;
select
count
(
*
)
from
lie_shop_picture
where
lie_pdf
like
'%.html%'
;
\ 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