Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.
This repository was archived by the owner on May 6, 2026. It is now read-only.

Error while saving a non-initialized JsonProperty #199

Description

@eyalhei

google-cloud-ndb==0.1.0

code example:

from google.cloud import ndb
with get_datastore_context():
class Test(ndb.Model):
prop = ndb.JsonProperty(compressed=True, json_type=dict)
a = Test()
a.put()

I get an exception:

Traceback (most recent call last):
a.put()
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/_options.py", line 91, in wrapper
return wrapped(*pass_args, _options=_options, **kwargs)
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 4917, in _put
return self._put_async(_options=_options).result()
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 190, in result
self.check_success()
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 137, in check_success
raise self._exception
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 293, in _advance_tasklet
yielded = self.generator.send(send_value)
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 4974, in put
ds_entity = _entity_to_ds_entity(self)
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 718, in _entity_to_ds_entity
names = prop._to_datastore(entity, data)
File "<venv>/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 2482, in _to_datastore
if not value.startswith(_ZLIB_COMPRESSION_MARKER):
AttributeError: 'NoneType' object has no attribute 'startswith'

Thanks for your awesome work!

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.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