utils.py 文件源码

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

项目:odin 作者: imito 项目源码 文件源码
def update(self, items):
    if self.read_only:
      return
    query = """UPDATE {tb} SET value=(?) WHERE key=("?");"""
    if isinstance(items, Mapping):
      items = items.items()
    # ====== check if update is in cache ====== #
    db_update = []
    for key, value in items:
      key = str(key)
      if key in self.current_cache:
        self.current_cache[key] = value
      else:
        db_update.append((marshal.dumps(value), key))
    # ====== perform DB update ====== #
    self.cursor.executemany(query.format(tb=self._current_table), db_update)
    self.connection.commit()
    return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号