loadsql.py 427 B

1234567891011
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3. import pymysql
  4. db = pymysql.connect(host="222.73.129.15", port=31306, user="root", passwd="kepaiteng!QAZ", db="eq", charset="utf8")
  5. sqlname =input("请输入sqlname:")
  6. cursor = db.cursor()
  7. err =cursor.execute("select sqlstr from apisql where sqlname =%s",sqlname)
  8. sqlstr =cursor.fetchone()
  9. write_file = open("../sql/%s.sql"%(sqlname), "w", encoding="utf-8").write(sqlstr[0])
  10. print()