Skip to content

property has list_value and don't want to index will raise exception #398

Description

@lucemia

if a property is list_value and the property name is included in exclude_from_indexes
the following exception will raise.

The protobuf file has describe this behavior

// A list value.
  // Cannot contain another list value.
  // Cannot also have a meaning and indexing set.
  repeated Value list_value = 7;

https://github.com/GoogleCloudPlatform/google-cloud-datastore/blob/v1beta2-rev1-2.1.0/proto/datastore_v1.proto#L123

 File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/entity.py", line 244, in save
    exclude_from_indexes=self.exclude_from_indexes())
  File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/connection.py", line 425, in save_entity
    result = self.commit(dataset_id, mutation)
  File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/connection.py", line 329, in commit
    datastore_pb.CommitResponse)
  File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/connection.py", line 81, in _rpc
    data=request_pb.SerializeToString())
  File "/usr/local/lib/python2.7/dist-packages/gcloud/datastore/connection.py", line 59, in _request
    raise Exception('Request failed. Error was: %s' % content)
Exception: Request failed. Error was: A Value containing a list_value cannot specify indexed.

An example

entity = Dataset(dataset, kind, exclude_from_indexes=('a',))
entity['a'] = [1,2,3]
entity.save()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions