def clear_index(self): topic_id_tuple = tuple( set(x['topic_id'] for x in self.topic_index_list)) sql = 'DELETE from TopicIndex where topic_id in ({})'.format( (' ?,' * len(topic_id_tuple))[:-1]) SqlClass.cursor.execute(sql, topic_id_tuple) SqlClass.commit() return
def save(self): self.clear_index() save_config = self.create_save_config() for key in save_config: for item in save_config[key]: if item: SqlClass.save2DB(item, key) SqlClass.commit() return
def clear_index(self): topic_id_tuple = tuple(set(x['topic_id'] for x in self.topic_index_list)) sql = 'DELETE from TopicIndex where topic_id in ({})'.format((' ?,' * len(topic_id_tuple))[:-1]) SqlClass.cursor.execute(sql, topic_id_tuple) SqlClass.commit() return