Skip to content

Problem handling local structured property kind without keys #627

@twumdjin

Description

@twumdjin

According to: https://cloud.google.com/appengine/docs/python/ndb/properties#structured
Local structured properties do not require keys and AppEngine appears to be fine with this.
Unfortunately, the gcloud-python library expects keys for every entity, even if they're local structured ones.
My work around is to update my entities in AppEngine to provide dummy keys, however, it would be nice if the library supported it natively.

gcloud/datastore/helpers.pyc in entity_from_protobuf(pb)
     46     :returns: The entity derived from the protobuf.
     47     """
---> 48     key = key_from_protobuf(pb.key)
     49     entity_props = {}
     50     exclude_from_indexes = []

gcloud/datastore/helpers.pyc in key_from_protobuf(pb)
    103         namespace = pb.partition_id.namespace
    104 
--> 105     return Key(*path_args, namespace=namespace, dataset_id=dataset_id)

gcloud/datastore/key.pyc in __init__(self, *path_args, **kwargs)
     74         # _flat_path, _parent, _namespace and _dataset_id must be set before
     75         # _combine_args() is called.
---> 76         self._path = self._combine_args()

gcloud/datastore/key.pyc in _combine_args(self)
     131         :raises: :class:`ValueError` if the parent key is not complete.
     132         """
--> 133         child_path = self._parse_path(self._flat_path)

gcloud/datastore/key.pyc in _parse_path(path_args)
      92         """
      93         if len(path_args) == 0:
---> 94             raise ValueError('Key path must not be empty.')

ValueError: Key path must not be empty.

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions