-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.
Description
Given this code:
from google.cloud import datastore
from google.cloud.datastore import Entity
client = datastore.Client()
with client.transaction() as xact:
e = Entity(client.key("Test", "123"))
e.update({"x": "a" * 1500000})
xact.put(e)version 0.19 of this library raises the following exception on .put:
Traceback (most recent call last):
File "test.py", line 8, in <module>
xact.put(e)
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/batch.py", line 302, in __exit__
self.commit()
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/transaction.py", line 167, in commit
super(Transaction, self).commit()
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/batch.py", line 274, in commit
self._commit()
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/batch.py", line 251, in _commit
self.project, self._commit_request, self._id)
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/connection.py", line 584, in commit
response = self._datastore_api.commit(project, request)
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/google/cloud/datastore/connection.py", line 314, in commit
return self._stub.Commit(request_pb)
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/grpc/_channel.py", line 481, in __call__
return _end_unary_response_blocking(state, False, deadline)
File "/Users/bogdan/.virtualenvs/bread/lib/python2.7/site-packages/grpc/_channel.py", line 432, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, The value of property "x" is longer than 1048487 bytes.)>Previously, this used to raise gcloud.exceptions.BadRequest. It seems like this exception should be caught by the library and a more appropriate one should be raised in its stead.
EDIT: It turns out the following snippet has the same issue so this is not transaction specific:
from google.cloud import datastore
from google.cloud.datastore import Entity
client = datastore.Client()
e = Entity(client.key("Test", "123"))
e.update({"x": "a" * 1500000})
client.put(e)EDIT 2: This does not work either, raising the same exception:
from google.cloud import datastore
from google.cloud.datastore import Entity
client = datastore.Client()
e = Entity(client.key("Test", "123"), exclude_from_indexes=("x",))
e.update({"x": "a" * 1500000})
client.put(e)Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.