GAE清除数据库

时间:2012-07-21 02:56:13

标签: google-app-engine google-cloud-datastore

我的数据存储区出错,导致我无法通过控制台查看。我想删除整个数据存储区并重新开始。

以下适用于开发服务器:

db.delete(db.Query(keys_only=True))

当我在远程服务器上运行相同的操作时,我收到以下错误(并且数据存储区未被清除)

    illegal key.path.element.type: __Stat_PropertyType_PropertyName_Kind__
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
    return handler.dispatch()
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch
    return method(*args, **kwargs)
  File "/base/data/home/apps/s~34thquote/1.360465535514332795/core/handlers/quotes.py", line 72, in get
    db.delete(db.Query(keys_only=True))
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 1610, in delete
    delete_async(models, **kwargs).get_result()
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 815, in get_result
    result = rpc.get_result()
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
    return self.__get_result_hook(self)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1653, in __delete_hook
    self.check_rpc_success(rpc)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1216, in check_rpc_success
    raise _ToDatastoreError(err)
BadRequestError: illegal key.path.element.type: __Stat_PropertyType_PropertyName_Kind__

1 个答案:

答案 0 :(得分:2)

如果要删除某种(或所有种类)的所有实体,最简单的方法是使用datastore_admin,它在您的实时应用程序的管理控制台中启用。