"""
author:张鑫
date:2021/8/13 16:37
"""
import pymysql
# 即将插入的数据
# url2 = ''
connect = pymysql.Connect(
host='140.210.4.73',
port=3306,
user='twipad_cj',
passwd='bj@#twipad_cj',
db='tw_ipaddb',
charset='utf8mb4'
)
ir_md5 = '95c56e5e77affb8db8c2fc1469809f0a'
cursor = connect.cursor()
sql1 = 'select ir_md5 from hkby_facebookhistory_abroaddataall'
cursor.execute(sql1)
ir_md5_dec = cursor.fetchall()
# 把需要查询的数据转变为元组
ir_md5 = tuple([ir_md5], )
if ir_md5 in ir_md5_dec:
pass
print('数据已存在')
else:
print('插入')
# 需要执行的sql语句
cursor.close()
connect.close()