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

Support 'blob_value' / 'blob_key_value' in datastore protobufs #233

Closed
tseaver opened this issue Oct 9, 2014 · 10 comments
Closed

Support 'blob_value' / 'blob_key_value' in datastore protobufs #233

tseaver opened this issue Oct 9, 2014 · 10 comments
Assignees
Labels
api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tseaver
Copy link
Contributor

tseaver commented Oct 9, 2014

In addition to the scalar types we already support, there are the following value types we don't yet
support:

@tseaver tseaver added api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Oct 9, 2014
@dhermes
Copy link
Contributor

dhermes commented Oct 9, 2014

This is something we could check in an automated fashion:

>>> from gcloud.datastore import datastore_v1_pb2 as pb2
>>> for attr in dir(pb2.Value):
...     if attr[0] == attr[0].lower() and attr[0] != '_':
...         print attr
... 
blob_key_value
blob_value
boolean_value
double_value
entity_value
indexed
integer_value
key_value
list_value
meaning
string_value
timestamp_microseconds_value

or

>>> for key in sorted(pb2._VALUE.fields_by_name.keys()):
...     print key
... 
blob_key_value
blob_value
boolean_value
double_value
entity_value
indexed
integer_value
key_value
list_value
meaning
string_value
timestamp_microseconds_value

@tseaver
Copy link
Contributor Author

tseaver commented Oct 16, 2014

Note that handling 'blob_value' values will require us to think harder about handling "bytes" (marshalled via 'blob_value') vs. "text" (marshalled via 'string_value'). At the moment, we rather sloppily conflate handling both Python2 'str' and 'unicode' via 'string_value'.

@silvolu
Copy link
Contributor

silvolu commented Oct 18, 2014

@tseaver as you mentioned in #157, we should raise exceptions after the value types coverage is complete.

@silvolu
Copy link
Contributor

silvolu commented Oct 18, 2014

I think we're missing value types in _get_protobuf_attribute_and_value(https://github.com/GoogleCloudPlatform/gcloud-python/blob/master/gcloud/datastore/_helpers.py#L17) as well.

@tseaver
Copy link
Contributor Author

tseaver commented Oct 18, 2014

That will get tricksy:

  • 'blob_value' should map to 'str' / 'bytes' in Python2, and 'bytes' in Python3
  • 'string_value' should map to 'unicode' in Python2, and 'str' in Python3

Right now:

>>> from gcloud.datastore._helpers import _get_protobuf_attribute_and_value
>>> _get_protobuf_attribute_and_value(b'foo')
('string_value', 'foo')
>>> _get_protobuf_attribute_and_value(u'foo')
('string_value', u'foo')
>>> _get_protobuf_attribute_and_value('foo')
('string_value', 'foo')

which can't be right, long-term. It should be (under Python2):

>>> _get_protobuf_attribute_and_value(b'foo')
('blob_value', 'foo')
>>> _get_protobuf_attribute_and_value(u'foo')
('string_value', u'foo')
>>> _get_protobuf_attribute_and_value('foo')
('blob_value', 'foo')

and under Py3k:

>>> _get_protobuf_attribute_and_value(b'foo')
('blob_value', 'foo')
>>> _get_protobuf_attribute_and_value('foo')
('string_value', u'foo')
>>> _get_protobuf_attribute_and_value('foo')
('string_value', 'foo')

OTOH, '_get_value_from_value_pb' looks right:

>>> from gcloud.datastore.datastore_v1_pb2 import Value
>>> v = Value()
>>> v.string_value = 'abc'
>>> from gcloud.datastore._helpers import _get_value_from_value_pb
>>> _get_value_from_value_pb(v)
u'abc'

We'd like for the following to work:

>>> vb = Value()
>>> vb.blob_value = b'abc'
>>> _get_value_from_value_pb(vb)
'abc'

but it currently returns None.

@tseaver tseaver self-assigned this Oct 18, 2014
@tseaver
Copy link
Contributor Author

tseaver commented Oct 18, 2014

Changing to use 'blob_value' for bytes / native str in Python2 will be the one which confounds users expectations.

@dhermes
Copy link
Contributor

dhermes commented Oct 18, 2014

Indeed. I wonder if people have done things to deal with this in other libraries. Potentially encoding/decoding to ASCII or something similar?

@silvolu
Copy link
Contributor

silvolu commented Oct 18, 2014

@tseaver Saw your fix for blob_value in #233.
If we add list_value to _set_protobuf_value, then we should support all value types when writing entities.

@tseaver
Copy link
Contributor Author

tseaver commented Oct 18, 2014

@silvolu see #265.

tseaver added a commit that referenced this issue Oct 19, 2014
Address #233: support blob_value in protobuf
@tseaver
Copy link
Contributor Author

tseaver commented Oct 20, 2014

#263 adds 'blob_value' support. @silvolu says we can skip 'blob_key_value'.

@tseaver tseaver closed this as completed Oct 20, 2014
@jgeewax jgeewax modified the milestones: Datastore Stable, M1: core, datastore & storage Jan 30, 2015
lukesneeringer pushed a commit that referenced this issue Feb 25, 2017
urshala pushed a commit to urshala/google-cloud-python that referenced this issue Jan 17, 2020
atulep pushed a commit that referenced this issue Apr 3, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py
atulep pushed a commit that referenced this issue Apr 6, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py
atulep pushed a commit that referenced this issue Apr 6, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py
atulep pushed a commit that referenced this issue Apr 18, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py
parthea pushed a commit that referenced this issue Jun 4, 2023
…d services (#233)

* docs: added Cloud Dataproc and Secret Manager to the list of supported services

PiperOrigin-RevId: 470029399

Source-Link: googleapis/googleapis@d1b1556

Source-Link: googleapis/googleapis-gen@6fa4e01
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmZhNGUwMTJjYjk5NGI2NWMzNDVjN2QxMDk2MGE2ZGIxZDBhNDhmNiJ9

* 🦉 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
Source-Link: https://github.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
parthea pushed a commit that referenced this issue Jun 4, 2023
…[autoapprove] (#233)

Source-Link: googleapis/synthtool@1f37ce7
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8e84e0e0d71a0d681668461bba02c9e1394c785f31a10ae3470660235b673086
parthea pushed a commit that referenced this issue Jun 4, 2023
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 472772457

Source-Link: googleapis/googleapis@855b74d

Source-Link: googleapis/googleapis-gen@b64b1e7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9
parthea pushed a commit that referenced this issue Jun 4, 2023
Source-Link: googleapis/synthtool@52aef91
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Jul 6, 2023
* feat: Add support for python 3.11

chore: Update gapic-generator-python to v1.8.0
PiperOrigin-RevId: 500768693

Source-Link: googleapis/googleapis@190b612

Source-Link: googleapis/googleapis-gen@7bf29a4
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2JmMjlhNDE0YjllY2FjMzE3MGYwYjY1YmRjMmE5NTcwNWMwZWYxYSJ9

* 🦉 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 Aug 15, 2023
…233)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea pushed a commit that referenced this issue Aug 15, 2023
Source-Link: googleapis/synthtool@703554a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b
parthea added a commit that referenced this issue Sep 14, 2023
…ic enums (#233)

* feat: enable "rest" transport in Python for services supporting numeric enums

PiperOrigin-RevId: 508143576

Source-Link: googleapis/googleapis@7a702a9

Source-Link: googleapis/googleapis-gen@6ad1279
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9

* 🦉 Updates from OwlBot post-processor

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

* set coverage level to 99

* 🦉 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 Sep 20, 2023
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 472561635

Source-Link: googleapis/googleapis@332ecf5

Source-Link: googleapis/googleapis-gen@4313d68
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9
parthea added a commit that referenced this issue Sep 22, 2023
fix(deps): require proto-plus>=1.15.0
parthea pushed a commit that referenced this issue Sep 22, 2023
parthea pushed a commit that referenced this issue Sep 22, 2023
🤖 I have created a release \*beep\* \*boop\*
---
## [2.5.0](https://github.com/googleapis/python-dataproc/compare/v2.4.0...v2.5.0) (2021-07-24)


### Features

* add always_use_jwt_access ([#209](https://github.com/googleapis/python-dataproc/issues/209)) ([6aec13c](https://github.com/googleapis/python-dataproc/commit/6aec13ce39a2afc0f36878bd61cff1614ec66972))


### Bug Fixes

* Attribute error Name while executing the sample code ([#205](https://github.com/googleapis/python-dataproc/issues/205)) ([cb0328f](https://github.com/googleapis/python-dataproc/commit/cb0328f3bfec416be9aec34d027fe0f48aab4242))
* **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#227](https://github.com/googleapis/python-dataproc/issues/227)) ([5acfcd0](https://github.com/googleapis/python-dataproc/commit/5acfcd019dede3684fdf23cbed8bfcebdce606af))
* disable always_use_jwt_access ([#215](https://github.com/googleapis/python-dataproc/issues/215)) ([a57e253](https://github.com/googleapis/python-dataproc/commit/a57e25388691335b6672613210ee566ed91dc97b))
* enable self signed jwt for grpc ([#233](https://github.com/googleapis/python-dataproc/issues/233)) ([7df4fef](https://github.com/googleapis/python-dataproc/commit/7df4fefdced730fffd9b994608575512efe8d72a))


### Documentation

* omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://github.com/googleapis/python-dataproc/issues/1127)) ([#201](https://github.com/googleapis/python-dataproc/issues/201)) ([feea064](https://github.com/googleapis/python-dataproc/commit/feea0642ea6dbd6e08d4e52c89789a6b17e4de97))
* add Samples section to CONTRIBUTING.rst ([#228](https://github.com/googleapis/python-dataproc/issues/228)) ([3e248c2](https://github.com/googleapis/python-dataproc/commit/3e248c29470d635abf0d6fa7ae84dc8370a86bef))

---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this issue Sep 22, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Sep 22, 2023
Source-Link: googleapis/synthtool@69fabae
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:562802bfac02e012a6ac34eda282f81d06e77326b82a32d7bbb1369ff552b387
parthea pushed a commit that referenced this issue Sep 22, 2023
* chore: use gapic-generator-python 0.65.2

PiperOrigin-RevId: 444333013

Source-Link: googleapis/googleapis@f91b6cf

Source-Link: googleapis/googleapis-gen@16eb360
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9

* 🦉 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 Sep 22, 2023
Source-Link: googleapis/synthtool@82f5cb2
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae

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 Sep 22, 2023
Source-Link: googleapis/synthtool@c6e69c4
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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>
parthea pushed a commit that referenced this issue Oct 21, 2023
Source-Link: googleapis/synthtool@4760d8d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828

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: add a new EkmService API

PiperOrigin-RevId: 425982419

Source-Link: googleapis/googleapis@8dff569

Source-Link: googleapis/googleapis-gen@b1538df
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjE1MzhkZjE2NDM5MjI2MDZkMDBlYzAzNjVjMWUwYTUxYmZiY2FiZiJ9

* 🦉 Updates from OwlBot

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
🤖 I have created a release *beep* *boop*
---


## [2.11.0](googleapis/python-kms@v2.10.1...v2.11.0) (2022-02-03)


### Features

* add a new EkmService API ([#233](googleapis/python-kms#233)) ([eb532f5](googleapis/python-kms@eb532f5))
* add api key support ([#230](googleapis/python-kms#230)) ([fdf62ae](googleapis/python-kms@fdf62ae))


### Bug Fixes

* resolve DuplicateCredentialArgs error when using credentials_file ([97f7ea5](googleapis/python-kms@97f7ea5))


### Documentation

* **samples:** fix typo in verify_asymmetric_ec.py ([#227](googleapis/python-kms#227)) ([3817d73](googleapis/python-kms@3817d73))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea added a commit that referenced this issue Oct 21, 2023
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

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

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
parthea added a commit that referenced this issue Oct 21, 2023
* chore: Update gapic-generator-python to v1.11.7

PiperOrigin-RevId: 573230664

Source-Link: googleapis/googleapis@93beed3

Source-Link: googleapis/googleapis-gen@f4a4eda
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjRhNGVkYWE4MDU3NjM5ZmNmNmFkZjkxNzk4NzIyODBkMWE4ZjY1MSJ9

* 🦉 Updates from OwlBot post-processor

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

* chore: Update gapic-generator-python to v1.11.8

PiperOrigin-RevId: 574178735

Source-Link: googleapis/googleapis@7307199

Source-Link: googleapis/googleapis-gen@ce3af21
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2UzYWYyMWI3YzU1OWE4N2MyYmVmYzA3NmJlMGUzYWVkYTNhMjZmMCJ9

* 🦉 Updates from OwlBot post-processor

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

* chore: Update gapic-generator-python to v1.11.9

PiperOrigin-RevId: 574520922

Source-Link: googleapis/googleapis@5183984

Source-Link: googleapis/googleapis-gen@a59af19
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU5YWYxOWQ0YWM2NTA5ZmFlZGYxY2MzOTAyOTE0MWI2YTViODk2OCJ9

* 🦉 Updates from OwlBot post-processor

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

* update post processor image; remove unused files

* 🦉 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 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Oct 22, 2023
* chore: exclude requirements.txt file from renovate-bot

Source-Link: googleapis/synthtool@f58d313
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6

* update constraints files

* fix(deps): require protobuf 3.20.2

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 22, 2023
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

chore(python): avoid .nox directories when building docs
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py
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. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants