fill_db.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:corporadb 作者: nlesc-sherlock 项目源码 文件源码
def check_dataset(self):
    '''
    check if dataset is already in database
    if found set self.dataset_id to the entry in the database
    return boolean
    '''
    self.cursor.execute('select id as rowid, name from dataset')
    citems = self.cursor.fetchall()
    names = [citem['name'] for citem in citems]  # get all names
    if names:
      try:
        idx = numpy.where(numpy.array(names)==self.datasetname)[0][0]
        self.dataset_id = citems[idx]['rowid']
        return True
      except IndexError:
        return False
    else:
      return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号