Skip to content

Size/length limits for Datastore properties are enforced differently than NDB  #1228

@eric-optimizely

Description

@eric-optimizely

The Datastore/NDB documentation states that BlobProperty (and other blob property types) can be of unlimited length (given that an Entity can still only be 1MB).
https://cloud.google.com/appengine/docs/python/ndb/properties#types

When using an unindexed JsonProperty (which is a blob type), the gcloud API enforces a 1500 byte limit, which creates a discrepancy between the GAE Datastore API, documentation, and our expectations.

Here's a stacktrace snippet:

Traceback (most recent call last):
  File "/script/datastore_helpers/gcloud_populate_datastore.py", line 266, in <module>
    populate_with_contents_of_file(path, args.profile)
  File "/script/datastore_helpers/gcloud_populate_datastore.py", line 229, in populate_with_contents_of_file
    api.put(gae_entities)
  File "/lib/python2.7/site-packages/gcloud/datastore/api.py", line 272, in put
    current.commit()
  File "/lib/python2.7/site-packages/gcloud/datastore/batch.py", line 207, in commit
    response = self.connection.commit(self._dataset_id, self.mutation)
  File "/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 324, in commit
    datastore_pb.CommitResponse)
  File "/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 108, in _rpc
    data=request_pb.SerializeToString())
  File "/lib/python2.7/site-packages/gcloud/datastore/connection.py", line 85, in _request
    raise make_exception(headers, content, use_json=False)
gcloud.exceptions.BadRequest: 400 The value of property &quot;variations.actions&quot; is longer than 1500 bytes.

FWIW: We're still using version 0.4.3 of this gcloud library, but since this response comes from your API, upgrading would not appear to resolve it.

Is there a way to work around this? Should we expect the Cloud Datastore API to have the same limits as the GAE Datastore/NDB API?

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