You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using NDB you can define entity properties as compressed and its value will be stored as a blob result of the compression (zlib) of the original value.
I tried to emulate this behavior using google-cloud-datastore library and I inserted a value (blob) exactly equal that the one that NDB inserts.
The first row has been inserted using NDB, the second one using cloud datastore library.
The problem is that NDB is not be able to detect the second row as a compressed value and when I read it returns the compressed value... not the uncompressed one as expected to be.
How do I have to insert a "NDB compressed value" using the API and make it readable using NDB?
Trying to figure out how NDB does, it seems that when a value is compressed it set a "meaning_uri" param. Probably we need a way to set that meaning also using the API.
@cpavon I'm pretty sure ndb sets a meaning on the property, which is a "bygone" feature of the datastore API (i.e. not officially supported). Can you retrieve the raw protobuf contents of each property and let me know the difference (I think it'd be faster than me deploying a GAE app)?
We don't "officially" support meanings. The non-public attribute _meanings is there so that we don't wipe meanings when put-ing an existing entity that has been updated.
Though we don't "officially" support it, you have identified a working code path so feel free to use it. The fact that _meanings is non-public means we may remove, rename or relocate it at any time.
I'm going to close this issue out, let us know if you need anything else?
Activity
dhermes commentedon Sep 29, 2017
@cpavon I'm pretty sure
ndbsets ameaningon the property, which is a "bygone" feature of the datastore API (i.e. not officially supported). Can you retrieve the raw protobuf contents of each property and let me know the difference (I think it'd be faster than me deploying a GAE app)?cpavon commentedon Oct 2, 2017
Yep, you're right, the value stored using NDB arrives with meaning "22".
And everything works fine if I set the proper meanings before the put operation using the API:
If I save the entity in that way NDB and API are be able to read it without problems.
Is that the right way to set the meanings?
dhermes commentedon Oct 2, 2017
We don't "officially" support meanings. The non-public attribute
_meaningsis there so that we don't wipe meanings whenput-ing an existing entity that has been updated.Though we don't "officially" support it, you have identified a working code path so feel free to use it. The fact that
_meaningsis non-public means we may remove, rename or relocate it at any time.I'm going to close this issue out, let us know if you need anything else?
move monitoring samples from python-docs-samples (#51)