select_example.py 248 B

123456789101112131415161718
  1. """
  2. Example
  3. pandas操作MySQL
  4. 查数据,结果用dataframe显示
  5. """
  6. from model.DataBaseUtils import MysqlUtils
  7. db = MysqlUtils()
  8. sql = "select * from notebook limit 10"
  9. df1 = db.beauty.getData_pd(sql)
  10. print(df1)
  11. # 关闭连接
  12. db.close()