Commit ccae3bc9 by 岳巧源

add new file

parent 2bfcc981
Showing with 33 additions and 3 deletions
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
...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment