dbtest.py 678 B

1234567891011121314
  1. import dataset
  2. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
  3. # cursor=db.query("SELECT q,cnt FROM hhh.gap_searchome order by cnt desc")
  4. # cursor=db.query("SELECT q,cnt FROM hhh.gap_hhh order by cnt desc")
  5. # cursor=db.query("SELECT q,cnt FROM hhh.gap_searchome where q not in (select q from hhh.gap_hhh) order by cnt desc;")
  6. # cursor=db.query("SELECT q,cnt FROM hhh.gap_d100 where q not in (select q from hhh.gap_hhh) order by cnt desc;")
  7. #cursor=db.query('SELECT * FROM seo.term_progress limit 10')
  8. #for c in cursor:
  9. # print(c['title'])
  10. table=db['test']
  11. table.insert({'id':1234,'name':'test name','title':'中文測市'})