lucemia
lucemia

Reputation: 6627

Appengine datstore keyname reserved keywords

I got the following error message telling me that __K__ cannot be used as datastore entity keyname. Is there a list of reserved keyname that I can follow?

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.

Upvotes: 0

Views: 440

Answers (1)

Romin
Romin

Reputation: 8816

As per the documentation at https://developers.google.com/appengine/docs/python/datastore/entities#Python_Kinds_and_identifiers , "All kind names that begin with two underscores (__) are reserved and may not be used."

Upvotes: 2

Related Questions