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

Query.fetch() w/o limit returns different results than w/ large limit. #491

Closed
tseaver opened this issue Jan 6, 2015 · 3 comments · Fixed by #492
Closed

Query.fetch() w/o limit returns different results than w/ large limit. #491

tseaver opened this issue Jan 6, 2015 · 3 comments · Fixed by #492
Assignees
Labels
api: datastore Issues related to the Datastore API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tseaver
Copy link
Contributor

tseaver commented Jan 6, 2015

No description provided.

@tseaver tseaver added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: datastore Issues related to the Datastore API. labels Jan 6, 2015
@tseaver tseaver self-assigned this Jan 6, 2015
@dhermes
Copy link
Contributor

dhermes commented Jan 6, 2015

Example:

>>> from gcloud import datastore
>>> from gcloud.datastore.entity import Entity
>>> from gcloud.datastore.key import Key
>>> from gcloud.datastore.query import Query
>>>
>>> datastore.set_default_connection()
>>> datastore.set_default_dataset(dataset_id='foo')
>>>
>>> q = Query(kind='Post')
>>> list(q.fetch(limit=0))
>>> []
>>>
>>> e = Entity(key=Key('Post'))
>>> e['foo'] = 'bar'
>>> e.save()
>>> e.key
<Key[{'kind': 'Post', 'id': 5021553624350720L}], dataset=foo>
>>>
>>> list(q.fetch())
[]
>>>
>>> list(q.fetch(limit=0))
[]
>>>
>>> list(q.fetch(limit=2))
[<Entity[{'kind': u'Post', 'id': 5021553624350720L}] {u'foo': 'bar'}>]

@dhermes
Copy link
Contributor

dhermes commented Jan 6, 2015

Also note – per our previous discussion about this – offset has a default while limit does not.

@dhermes
Copy link
Contributor

dhermes commented Jan 6, 2015

Also, something which may help us in the future

>>> from gcloud.datastore import datastore_v1_pb2 as datastore_pb
>>> limit_field = datastore_pb.Query.DESCRIPTOR.fields_by_name['limit']
>>> offset_field = datastore_pb.Query.DESCRIPTOR.fields_by_name['offset']
>>> offset_field.has_default_value
True
>>> limit_field.has_default_value
False
>>> offset_field.default_value
0

@jgeewax jgeewax modified the milestone: Datastore Stable Jan 30, 2015
tswast added a commit to tswast/google-cloud-python that referenced this issue Mar 26, 2019
* Fixes BQ Models API generated code for Python 2.7

* Format quoted strings as plain text.
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 7, 2020
atulep pushed a commit that referenced this issue Apr 3, 2023
* docs: Clarified boost usage

PiperOrigin-RevId: 506405333

Source-Link: googleapis/googleapis@c8a382b

Source-Link: googleapis/googleapis-gen@655941e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU1OTQxZTE5M2ZhOTNjYmIyZWFjN2FkNWNkMmI5NDNiM2NmMjg3ZSJ9

* 🦉 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>
atulep pushed a commit that referenced this issue Apr 6, 2023
* docs: Clarified boost usage

PiperOrigin-RevId: 506405333

Source-Link: googleapis/googleapis@c8a382b

Source-Link: googleapis/googleapis-gen@655941e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU1OTQxZTE5M2ZhOTNjYmIyZWFjN2FkNWNkMmI5NDNiM2NmMjg3ZSJ9

* 🦉 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>
atulep pushed a commit that referenced this issue Apr 6, 2023
* docs: Clarified boost usage

PiperOrigin-RevId: 506405333

Source-Link: googleapis/googleapis@c8a382b

Source-Link: googleapis/googleapis-gen@655941e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU1OTQxZTE5M2ZhOTNjYmIyZWFjN2FkNWNkMmI5NDNiM2NmMjg3ZSJ9

* 🦉 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>
atulep pushed a commit that referenced this issue Apr 18, 2023
* docs: Clarified boost usage

PiperOrigin-RevId: 506405333

Source-Link: googleapis/googleapis@c8a382b

Source-Link: googleapis/googleapis-gen@655941e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU1OTQxZTE5M2ZhOTNjYmIyZWFjN2FkNWNkMmI5NDNiM2NmMjg3ZSJ9

* 🦉 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
Source-Link: https://github.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7
parthea pushed a commit that referenced this issue Sep 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this issue Sep 22, 2023
…ic enums (#491)

* 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

* fix: Add service_yaml_parameters to py_gapic_library BUILD.bazel targets

PiperOrigin-RevId: 510187992

Source-Link: googleapis/googleapis@5edc235

Source-Link: googleapis/googleapis-gen@b0bedb7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBiZWRiNzJlNDc2NWEzZTBiNjc0YTI4YzUwZWEwZjlhOWIyNmE4OSJ9

* 🦉 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.8.5

PiperOrigin-RevId: 511892190

Source-Link: googleapis/googleapis@a45d9c0

Source-Link: googleapis/googleapis-gen@1907294
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkwNzI5NGIxZDgzNjVlYTI0ZjhjNWYyZTA1OWE2NDEyNGM0ZWQzYiJ9

* 🦉 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: Victor Chudnovsky <vchudnov@google.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: 472561635

Source-Link: googleapis/googleapis@332ecf5

Source-Link: googleapis/googleapis-gen@4313d68
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9
parthea pushed a commit that referenced this issue Oct 21, 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 Oct 21, 2023
…mplates/python_library/.kokoro (#491)

Source-Link: googleapis/synthtool@30bd01b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b

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
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this issue Oct 22, 2023
* docs: Clarified boost usage

PiperOrigin-RevId: 506405333

Source-Link: googleapis/googleapis@c8a382b

Source-Link: googleapis/googleapis-gen@655941e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU1OTQxZTE5M2ZhOTNjYmIyZWFjN2FkNWNkMmI5NDNiM2NmMjg3ZSJ9

* 🦉 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>
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. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants