def DeleteRange(client, table, callback):
  def _OnQuery(retry_cb, count, result):
    count += len(result.items)
    if not result.last_key:
      result_cb = partial(callback, 'deleted %d items' % count)
    else:
      logging.info('deleting next %d items from %s' % (len(result.items), table.name))
      result_cb = partial(retry_cb, result.last_key, count)
    with util.Barrier(result_cb) as b:
      for item in result.items:
        key = db_client.DBKey(options.options.hash_key, item[table.range_key_col.key])
        client.DeleteItem(table=table.name, key=key, callback=b.Callback())

  def _Query(last_key=None, count=0):
    client.Query(table.name, options.options.hash_key, None, partial(_OnQuery, _Query, count),
                 None, limit=100, excl_start_key=last_key)

  _Query()
Deletes all items in the range identified by --hash_key.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/tools/raw_dba.py/DeleteRange