-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storing embedded entity, it's ignoring exclude_from_indexes from embedded #1206
Comments
@pcostell What's the expected behavior here? |
This should succeed. I am able to get this to work successfully directly from the API (in a commit):
Gives me a 200. |
It looks like information about |
Thanks @pcostell! |
@pcostell thanks for debugging this. |
To do this, added entity_to_protobuf method that could be used recursively. Also solves googleapis#1206 since recursively serializing nested entities to protobuf was being done incorrectly. Fixes googleapis#1065. Fixes googleapis#1206.
To do this, added entity_to_protobuf method that could be used recursively. Also solves googleapis#1206 since recursively serializing nested entities to protobuf was being done incorrectly. Fixes googleapis#1065. Fixes googleapis#1206.
To do this, added entity_to_protobuf method that could be used recursively. Also solves googleapis#1206 since recursively serializing nested entities to protobuf was being done incorrectly. Fixes googleapis#1065. Fixes googleapis#1206.
@igama This has been fixed: >>> from gcloud import datastore
>>> from gcloud.environment_vars import TESTS_DATASET
>>> from gcloud.datastore import client
>>> client.DATASET = TESTS_DATASET
>>> CLIENT = datastore.Client()
>>> record_key = CLIENT.key('Record', 1234)
>>> record_entity = datastore.Entity(record_key)
>>> embedded_key = CLIENT.key('Data', 5678)
>>> embedded_entity = datastore.Entity(key=embedded_key, exclude_from_indexes=('big_field',))
>>> embedded_entity['field1'] = '1234'
>>> embedded_entity['big_field'] = 'large string bigger than 1500bytes ' * 50
>>> len(embedded_entity['big_field'])
1750
>>> record_entity['RandomFieldName'] = embedded_entity
>>> CLIENT.put(record_entity)
>>> CLIENT.put(embedded_entity)
>>>
>>> CLIENT.delete(record_entity.key)
>>> CLIENT.delete(embedded_entity.key) |
Note -- This should probably use exclude_from_indexes=('RandomFieldName.big_field') Otherwise, there is no way to exclude nested field vs non-nested fields. |
@pcostell I'm not sure what you mean RE: "there is no way" --- see the above. The way is to exclude them on the nested As for the name used, see the reported snippet at the top of this issue. |
Ah sorry definitely read recorded_entity instead of embedded_entity at embedded creation. Please ignore my comment :-) |
No worries. Thanks for taking the time to read the notification |
@dhermes thank you, Will try it in the next days. |
I'm trying to have a embedded entity with a field that is larger than 1500bytes. I add that field to the exclude_from_indexes key of the embedded entity. When I try and save the parent Entity it tells me the field is bigger than 1500bytes. If I save the embedded entity independently, it works.
Is exclude_from_indexes ignored on embedded entity?
The text was updated successfully, but these errors were encountered: