Conversation
gcloud/datastore/connection.py
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
|
|
@dhermes ndbgcloud-python |
|
@lucemia I was curious to see what actually is stored, which requires inspecting the retrieved protobuf. After storing >>> from gcloud import datastore
>>> from gcloud.datastore.entity import Entity
>>> from gcloud.datastore.key import Key
>>>
>>> datastore.set_default_connection()
>>> dataset_id = 'datasetfoo'
>>> datastore.set_default_dataset_id(dataset_id)
>>>
>>> key = Key('Kind', 1234)
>>> entity = Entity(key=key)
>>> entity['foo'] = None
>>> dict(entity)
{'foo': None}
>>> entity.save()retrieving the same entity shows that the property is set but >>> entity_pb, = datastore.get_connection().lookup(
... dataset_id=dataset_id,
... key_pbs=[key.to_protobuf()],
... )
>>> prop_foo, = entity_pb.property
>>> prop_foo.name
u'foo'
>>> prop_foo_value = prop_foo.value
>>> prop_foo_value._fields
{}This happens because in It's unclear what is the right thing to support, maybe going with Cleanup: >>> print entity_pb
key {
partition_id {
dataset_id: "s~datasetfoo"
}
path_element {
kind: "Kind"
id: 1234
}
}
property {
name: "foo"
value {
}
}
>>> entity.key.delete() |
Currently I go with ndb way. I updated the note to only include empty list case.
Store a ps. Rebase is welcome In ndb, pass an empty list will cause a special s~tagtooadex2> Kind.query(Kind.bar.IN([]))
Query(kind='Kind', filters=<google.appengine.ext.ndb.query.FalseNode object at 0x104ab5210>)
s~tagtooadex2> Kind.query(Kind.bar.IN(['a']))
Query(kind='Kind', filters=FilterNode('bar', '=', 'a'))and raise exception while query. s~tagtooadex2> Kind.query(Kind.bar.IN([])).fetch()
WARNING:root:initial generator _run_to_list(query.py:956) raised BadQueryError(Cannot convert FalseNode to predicate)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/utils.py", line 142, in positional_wrapper
return wrapped(*args, **kwds)
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 1187, in fetch
return self.fetch_async(limit, **q_options).get_result()
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
self.check_success()
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/tasklets.py", line 371, in _help_tasklet_along
value = gen.send(val)
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 961, in _run_to_list
dsquery = self._get_query(conn)
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 908, in _get_query
filters = filters._to_filter()
File "/Users/david/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/query.py", line 425, in _to_filter
'Cannot convert FalseNode to predicate')
BadQueryError: Cannot convert FalseNode to predicate |
|
I see, I was thinking the issue was the code, but you're saying the expected behavior is a bit subtle. Also, what do you mean by "Rebase is welcome"? |
Last pull request you ask about re-writeing history. I mean feel free to do so if necessary :) |
…helper function.
479ea6a to
a250cb2
Compare
|
I have squash the commit |
Ignore Entity property with empty list
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 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>
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 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>
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 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>
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 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: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@f15cc72 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd
* feat: add SPOT to Preemptibility enum PiperOrigin-RevId: 503019826 Source-Link: googleapis/googleapis@77cd8f1 Source-Link: googleapis/googleapis-gen@a3b02db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTNiMDJkYmIzMzljZjhkYWU1ZDYxMTQ1MDI5MmI3ODIwZjEyMDA3NSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: googleapis/googleapis-gen@0080f83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 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>
* chore(samples): Remove samples Samples migrated to https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/monitoring GoogleCloudPlatform/python-docs-samples#8472 * Add README with link to new samples location
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* docs: Fix formatting of request arg in docstring chore: Update gapic-generator-python to v1.9.1 PiperOrigin-RevId: 518604533 Source-Link: googleapis/googleapis@8a085ae Source-Link: googleapis/googleapis-gen@b2ab4b0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9 * 🦉 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>
Source-Link: googleapis/synthtool@993985f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd
- Pass the app_profile_id from the message - Update unittest Fixes internal bug #214449800
* Enable support and testing for python 3.11 * feat: Enable support and testing for python 3.11 * build: Add kokoro configuration for python 3.11 * build: Remove kokoro configuration for python 3.11 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add unit_test_python_versions arg * 🦉 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>
* feat: add new types QueryMode, QueryPlan, ResultSetStats feat: add QueryMode field to RunQueryRequest feat: add ResultSetStats field to RunQueryResponse feat: add QueryMode field to RunAggregationQueryRequest feat: add ResultSetStats field to RunAggregationQueryResponse PiperOrigin-RevId: 595774772 Source-Link: googleapis/googleapis@03e7ed4 Source-Link: googleapis/googleapis-gen@dc63e0d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGM2M2UwZGVhODQyM2MyMzBkNWZiMDkzN2FjYjNjOTg3MTljOTM5NSJ9 * 🦉 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>
…512) * chore(python): Use latest python runtime in prerelease_deps session Source-Link: googleapis/synthtool@14d8b28 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5651442a6336971a2fb2df40fb56b3337df67cafa14c0809cc89cb34ccee1b8e * filter warnings from google-cloud-logging 1.x --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore: allow releases on previous majors * 🦉 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>
* chore: allow releases on previous majors * 🦉 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>
for issue #403
Previous PR
#404