GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — raise unexpected exception while property value is [] · Issue #403 · googleapis/google-cloud-python

raise unexpected exception while property value is [] #403

New issue
Copy link
New issue
Copy link
Closed
Closed
raise unexpected exception while property value is []#403
Copy link
Assignees
dhermes
Labels
🚨This issue needs some love.api: datastoreIssues related to the Datastore API.triage meI really want to be triaged.

Description

@lucemia
lucemia
opened on Dec 3, 2014
Issue body actions

the following sample code

entity = Entity(dataset, 'test')
entity['a'] = []
entity.save()

will raise exception

File "/usr/local/lib/python2.7/dist-packages/gcloud-0.3.0-py2.7.egg/gcloud/datastore/entity.py", line 244, in save
    exclude_from_indexes=self.exclude_from_indexes())
  File "/usr/local/lib/python2.7/dist-packages/gcloud-0.3.0-py2.7.egg/gcloud/datastore/connection.py", line 429, in save_entity
    result = self.commit(dataset_id, mutation)
  File "/usr/local/lib/python2.7/dist-packages/gcloud-0.3.0-py2.7.egg/gcloud/datastore/connection.py", line 329, in commit
    datastore_pb.CommitResponse)
  File "/usr/local/lib/python2.7/dist-packages/gcloud-0.3.0-py2.7.egg/gcloud/datastore/connection.py", line 81, in _rpc
    data=request_pb.SerializeToString())
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 813, in SerializeToString
    self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors())))
EncodeError: Message api.services.datastore.CommitRequest is missing required fields: mutation.upsert[0].property[0].value

It (protobuf) makes no distinction between an empty list and a null list.

http://stackoverflow.com/questions/2378666/protobuf-net-serializing-an-empty-list
it looks like a property with empty list should be skip entirely

Activity

Next
  1. tseaver commented on Dec 3, 2014

    @tseaver
    tseaver
    on Dec 3, 2014
    Contributor
    More actions

    https://github.com/tseaver/gcloud-python/commit/876d7fe75c9c9277dfcd05d00160e75f53658d82 is an alternate approach: it marshalls an empty list to-from a custom sub-entity. AFAICT the sub-entity approach (which might also be useful for making 'None' an explicit value) only works if the "empty list" field is excluded from indexing.

  2. dhermes commented on Dec 21, 2014

    @dhermes
    dhermes
    on Dec 21, 2014
    Contributor
    More actions

    I actually dove in and tried to make this work at the proto level and agree with @bryanyang0528 that it should be skipped entirely.

  3. dhermes
    added
    api: datastoreIssues related to the Datastore API.
    on Dec 30, 2014
  4. lucemia
    added a commit that references this issue on Jan 12, 2015

    fix empty list issue googleapis#403 by add a _set_protobuf_property …

    a250cb2
  5. dhermes
    closed this as completedon Jan 13, 2015
  6. dhermes commented on Jan 13, 2015

    @dhermes
    dhermes
    on Jan 13, 2015
    Contributor
    More actions

    Fixed by #512

  7. jgeewax
    modified the milestone: This milestone has been deleted on Jan 30, 2015
  8. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 7, 2020
  9. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  10. atulep
    added 3 commits that reference this issue on Apr 3, 2023

    chore: test minimum dependencies in python 3.7 (#403)

    1d0a142

    chore: test minimum dependencies in python 3.7 (#403)

    8aad91e

    chore: test minimum dependencies in python 3.7 (#403)

    e2e55f9
  11. atulep
    added a commit that references this issue on Apr 18, 2023

    chore: test minimum dependencies in python 3.7 (#403)

    bf19215
  12. 14 remaining items

  13. parthea
    added a commit that references this issue on Oct 22, 2023

    chore: test minimum dependencies in python 3.7 (#403)

    39bbb12
  14. parthea
    added a commit that references this issue on Aug 21, 2025

    docs: improve documentation for write client (#403)

    770da17
  15. parthea
    added 2 commits that reference this issue on Sep 16, 2025

    docs: improve documentation for write client (#403)

    5689428

    chore(deps): update all dependencies (#403)

    47ca7d1
  16. parthea
    added 7 commits that reference this issue on Nov 24, 2025

    Update dependency click to v7.1.2 (#403)

    83ed7fc

    chore(python): Noxfile recognizes that tests can live in a folder (#403)

    33fdfb4

    chore(deps): update dependency pytest to v7.2.1 (#403)

    1e8c122

    chore(main): release 1.7.0 (#403)

    ebc5250

    chore: drop six (#403)

    bae836a

    docs: show no longer supported options as deprecated (#403)

    7664c4e

    chore: drop six (#403)

    0d03c61
  17. parthea
    added 2 commits that reference this issue on Mar 2, 2026

    chore: template updates (#403)

    3c2e461

    feat: support brotli encoding (#403)

    93e862a
  18. parthea
    added 2 commits that reference this issue on Mar 9, 2026

    chore(deps): update dependency urllib3 to v1.26.19 [security] (#403)

    6d36140

    chore(python): Update the python version in docs presubmit to use 3.10 (

    56e290b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

🚨This issue needs some love.api: datastoreIssues related to the Datastore API.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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.