Skip to content
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

fix: repeated structured property containing blob property with legacy_data (#817) #946

Merged
merged 7 commits into from
Feb 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issue 817
  • Loading branch information
ventice committed Feb 13, 2024
commit 50590b5096ae5d2d78a57ad50330fd949608822f
11 changes: 7 additions & 4 deletions google/cloud/ndb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2652,11 +2652,14 @@ def _to_datastore(self, entity, data, prefix="", repeated=False):
value = compressed_value
data[key] = value
if not self._repeated:
if value and not value.startswith(_ZLIB_COMPRESSION_MARKERS):
value = zlib.compress(value)
data[key] = value
values = [
zlib.compress(v) if v and not v.startswith(_ZLIB_COMPRESSION_MARKERS) else v
for v in (value if repeated else [value])
]
value = values if repeated else values[0]
data[key] = value

if value:
if value and not repeated:
sorced-jim marked this conversation as resolved.
Show resolved Hide resolved
data.setdefault("_meanings", {})[key] = (
_MEANING_COMPRESSED,
value,
Expand Down