revise_table_data_to_table.py 558 Bytes
# -*- coding:UTF-8 -*-
# @Time  : 2020/8/19 11:47
# @File  : revise_table_data_to_table.py
# @email : litao@igengmei.com
# @author : litao
import pymysql


def con_sql(sql):
    # 从数据库的表里获取数据
    """
	:type sql : str
	:rtype : tuple
	"""
    db = pymysql.connect(host='172.16.40.158', port=4000, user='st_user', passwd='YPEzp78HQBuhByWPpefQu6X3D6hEPfD6',
                         db='jerry_prod')
    cursor = db.cursor()
    cursor.execute(sql)
    result = cursor.fetchall()
    db.close()
    return result


sql = "slect * from xxx"