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

raise unexpected exception while property value is [] #403

Closed
lucemia opened this issue Dec 3, 2014 · 3 comments
Closed

raise unexpected exception while property value is [] #403

lucemia opened this issue Dec 3, 2014 · 3 comments
Assignees
Labels
api: datastore Issues related to the Datastore API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@lucemia
Copy link
Contributor

lucemia commented Dec 3, 2014

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

@lucemia lucemia mentioned this issue Dec 3, 2014
@tseaver
Copy link
Contributor

tseaver commented Dec 3, 2014

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.

@dhermes
Copy link
Contributor

dhermes commented Dec 21, 2014

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

@dhermes dhermes added the api: datastore Issues related to the Datastore API. label Dec 30, 2014
lucemia added a commit to lucemia/gcloud-python that referenced this issue Jan 12, 2015
@dhermes dhermes closed this as completed Jan 13, 2015
@dhermes
Copy link
Contributor

dhermes commented Jan 13, 2015

Fixed by #512

@jgeewax jgeewax modified the milestone: Datastore Stable Jan 30, 2015
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
parthea added a commit that referenced this issue Jun 4, 2023
* chore(python): drop python 3.6

Source-Link: googleapis/synthtool@4f89b13
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c

* add api_description to .repo-metadata.json

* require python 3.7+ in setup.py

* remove python 3.6 sample configs

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* trigger CI

* add python_requires to setup.py

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Jun 4, 2023
…SCC (#403)

* feat: Adding project/folder level parents to notification configs in SCC

PiperOrigin-RevId: 481230115

Source-Link: googleapis/googleapis@94efa50

Source-Link: googleapis/googleapis-gen@cf106b5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2YxMDZiNWMwZDRmNzI3YThiZmM4ZTIzNzQ5MzMwNDIxZjQwYjgxNyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Jun 4, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Aug 15, 2023
Source-Link: googleapis/synthtool@050953d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 20, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
vchudnov-g pushed a commit that referenced this issue Sep 20, 2023
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
* feat: add APIs for GKE OOTB metrics packages

PiperOrigin-RevId: 554852538

Source-Link: googleapis/googleapis@ac012ee

Source-Link: googleapis/googleapis-gen@91ddf77
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTFkZGY3NzlkNTA2NzEzZjI4YmIyYTE3MTdhYzI4N2YyMjVlZTNkMiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add APIs for GKE OOTB metrics packages

PiperOrigin-RevId: 554853517

Source-Link: googleapis/googleapis@4879bb2

Source-Link: googleapis/googleapis-gen@3151254
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzE1MTI1NGFjNDUyY2E5M2YyNDZmOTVkYjk4NjkwYjg0OWE1ZTU4ZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
* chore: Update gapic-generator-python to v1.8.4

PiperOrigin-RevId: 507808936

Source-Link: googleapis/googleapis@64cf849

Source-Link: googleapis/googleapis-gen@53c48ca
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNjNDhjYWMxNTNkM2IzN2YzZDJjMmRlYzQ4MzBjZmQ5MWVjNDE1MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
* feat: Update Compute Engine API to revision 20230307 (#786)

Source-Link: googleapis/googleapis@f64a3c8

Source-Link: googleapis/googleapis-gen@808541b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODA4NTQxYjdlNzY5N2UyOTg0YTBlYTBlYmExYWRiNTU2MGRhZGU5NyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Oct 21, 2023
* feat: add interoperable symmetric encryption system

PiperOrigin-RevId: 549699686

Source-Link: googleapis/googleapis@68e699a

Source-Link: googleapis/googleapis-gen@f2314eb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjIzMTRlYjI1ZDA3YjZhOTVhODU5OTljZmNhOGJiZGE2ODQ4ZDIwNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Oct 21, 2023
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 459095142

Source-Link: googleapis/googleapis@4f1be99

Source-Link: googleapis/googleapis-gen@ae686d9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9

feat: add audience parameter
PiperOrigin-RevId: 456827138

Source-Link: googleapis/googleapis@23f1a15

Source-Link: googleapis/googleapis-gen@4075a85
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9
parthea pushed a commit that referenced this issue Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants