def get_or_create_school(name): sid = db.find_one_val('select id from school where name=%s', [name]) if sid is not None: return sid else: print 'insert' return db.insert('school', {'name': name})
if info.has_key('workInfo'): save_work_info(uid, info['workInfo']) del info['workInfo'] if info.has_key('frd_list'): save_friends_info(uid, info['frd_list']) del info['frd_list'] save_basic_info(uid, info) # uid = '21441' # print 'get_info' # info = get_info(uid) # print 'info', json.dumps(info, encoding="UTF-8", ensure_ascii=False) while True: uid = db.find_one_val('select uid from student where has_visit_info=0 limit 1') if uid: print '--------------------',uid info = get_info(uid) if info == False: print 'error' break print json.dumps(info, encoding="UTF-8", ensure_ascii=False) save_info(uid, info) # break else: break