Appengine数据存储区密钥名称保留关键字

时间:2013-12-04 14:09:04

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

我收到以下错误消息,告诉我__K__不能用作数据存储区实体键名。 是否有我可以遵循的保留键名列表?

Traceback (most recent call last):
  File "/base/data/home/apps/s~tagtooadex2/test:v1.372093270511118603/mapreduce/handlers.py", line 401, in handle
    tstate.input_reader, shard_state, tstate, ctx)
  File "/base/data/home/apps/s~tagtooadex2/test:v1.372093270511118603/mapreduce/handlers.py", line 465, in process_inputs
    entity, input_reader, ctx, tstate):
  File "/base/data/home/apps/s~tagtooadex2/test:v1.372093270511118603/mapreduce/handlers.py", line 502, in process_data
    result = handler(data)
  File "/base/data/home/apps/s~tagtooadex2/test:v1.372093270511118603/main.py", line 124, in mapper
    obj.put()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3232, in _put
    return self._put_async(**ctx_options).get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
    self.check_success()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/context.py", line 748, in put
    key = yield self._put_batcher.add(entity, options)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/context.py", line 280, in _put_tasklet
    keys = yield self._conn.async_put(options, datastore_entities)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 454, in _on_rpc_completion
    result = rpc.get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 612, in get_result
    return self.__get_result_hook(self)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1675, in __put_hook
    self.check_rpc_success(rpc)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1236, in check_rpc_success
    raise _ToDatastoreError(err)
BadRequestError: The key.key.path.element.name "__K__" is reserved.

1 个答案:

答案 0 :(得分:2)

根据https://developers.google.com/appengine/docs/python/datastore/entities#Python_Kinds_and_identifiers的文档,“以两个下划线(__)开头的所有类型名称都是保留的,可能无法使用。”