importpymysqlclassDataMigrate:def __init__(self, env):
self.num= 50self.ENV=env#From
self.db_from = self.connect_jingyi(1)
self.cursor_from=self.db_from.cursor()
self.from_sql= ‘select first_project, status from product‘
#To
self.db_to =self.connect_jingyi()
self.cursor_to=self.db_to.cursor()
self.to_sql= "insert into product_copy(first_project, status) value(%s,%s)"
def connect_jingyi(self, is_jingyi=0):ifis_jingyi:if self.ENV == ‘test‘:return pymysql.connect(host=‘****‘,
port=3306,
user=‘***‘,
passwd=‘***‘,
db=‘from_db‘,
charset=‘utf8‘)else:return pymysql.connect(host=‘****‘,
port=3306,
user=‘***‘,
passwd=‘***‘,
db=‘from_db‘,
charset=‘utf8‘)else:if self.ENV == ‘test‘:return p