create_fake.py 428 B

1234567891011121314151617
  1. import dataset
  2. import datetime
  3. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/cmm_test?charset=utf8mb4')
  4. news_table = db['tag_table']
  5. print(type(news_table))
  6. #for idx in range(5):
  7. #news_table.insert({'name':'標籤'+str(idx),'remark':'remark'+str(idx)})
  8. table = db.load_table('tag_table')
  9. statement = 'SELECT id,name FROM tag_table'
  10. for row in db.query(statement):
  11. print(row['name'], row['id'])