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 — Makes operator checking deterministic in Query.filter. by dhermes · Pull Request #294 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Oct 24, 2014

Copy link
Copy Markdown
Contributor

The order of dictionary keys is not guaranteed between runs of
code so expressions ending in '>=' or '<=' were sometimes
matching for '='.

@pcostell the issue with flakiness was non-deterministic behavior of Python internals. Yay for finding the bug!

This was holding up #281, but it also forced us to use ancestor queries, which is a good thing.

@tseaver This is the quick-and-dirtiest way to fix this issue but I am a fan of changing from

query.filter('foo >=', 10)

to

query.filter('foo', '>=', 10)

WDYT?

Also @jgeewax WDYT since your original design. (Maybe you had reasons for combination property name and operator?)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coveralls

coveralls commented Oct 25, 2014

Copy link
Copy Markdown

Coverage Status

Coverage remained the same when pulling af1a39f on dhermes:query-operator-fix-dict-random-order into b6d3e74 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jgeewax

jgeewax commented Oct 25, 2014

Copy link
Copy Markdown
Contributor

I'm -1 to making it filter(field, operator, value) -- the reason being that this is how google.appengine.ext.db/ndb handled filtering (I just modeled it after them).

Another option to fix this is to use a regex:

  • The regex used in appengine.db
  • The filter method using the regex

I'd also feel much better if there were failing test to reproduce this as it's kind of a tricky bug... Any chance you could toss one in? Or add a ticket to make sure we have one to avoid regressing?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Oct 25, 2014

Copy link
Copy Markdown
Contributor Author

@jgeewax RE: emulating db, this library is more low-level. If/when we build something more high-level, (for me) the "right" way to do this is the ndb way

qry = Account.query(Account.userid == 42)

I would also guess that they were like that in db for historical reasons (i.e. a different proto def).

As for a regression test, #281 is what made us discover this bug in the first place and I just commited fc23837.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Oct 25, 2014

Copy link
Copy Markdown

Coverage Status

Coverage remained the same when pulling fc23837 on dhermes:query-operator-fix-dict-random-order into b6d3e74 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jgeewax

jgeewax commented Oct 25, 2014

Copy link
Copy Markdown
Contributor

👍 -- I think for this library, filter('field >=' value) is the right abstraction.

For a higher-level library (maybe we'll even pull ndb over ...) I absolutely agree with you that the ndb way is ideal (for example, it's far nicer than the Django ORM way..)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes mentioned this pull request Oct 26, 2014
Functional test - Add datastore query tests #281
Merged
@Alfus

Alfus commented Oct 27, 2014

Copy link
Copy Markdown

I think filter('field', op, value) is technically better but more cumbersome. As long as filter('field', value) is not valid and filter('field with spaces =', value) is valid I think this function signature is workable (though it likely does not support property names with trailing white spaces).

Another option that doesn't require a full ORM is just adding a Property class with operator overloading: filter(Property('field') >= value)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Oct 27, 2014

Copy link
Copy Markdown
Contributor Author

@Alfus that is on the roadmap, but as part of a higher-level abstraction than this one. Here we essentially want to mimic the API. In that vein, the .proto def has three fields rather than two, but I have no strong preference.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes added api: datastore Issues related to the Datastore API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 27, 2014
dhermes added 2 commits October 27, 2014 11:05
@dhermes
Makes operator checking deterministic in Query.filter.
f8a4db4
The order of dictionary keys is not guaranteed between runs of
code so `expression`s ending in '>=' or '<=' were sometimes
matching for '='.
@dhermes
Adding test to make sure the correct operators get set on filter.
799b6b7
@dhermes
dhermes force-pushed the query-operator-fix-dict-random-order branch from fc23837 to 799b6b7 Compare October 27, 2014 18:05
@dhermes

dhermes commented Oct 27, 2014

Copy link
Copy Markdown
Contributor Author

Rebased after #292

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Oct 27, 2014

Copy link
Copy Markdown

Coverage Status

Coverage remained the same when pulling 799b6b7 on dhermes:query-operator-fix-dict-random-order into f7d0441 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver reviewed Oct 27, 2014
View reviewed changes
Comment thread gcloud/datastore/query.py Outdated

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
Using operator dict in datastore.query and splitting on whitespace.
f47ffa1
@tseaver

tseaver commented Oct 27, 2014

Copy link
Copy Markdown
Contributor

LGTM pending Travis.

I don't know if we want to default to assuming equality in the case that there is no operator, but that shouldn't be a blocker.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Oct 27, 2014

Copy link
Copy Markdown

Coverage Status

Coverage remained the same when pulling f47ffa1 on dhermes:query-operator-fix-dict-random-order into f7d0441 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
Adding test for datastore.query.filter with no operator used.
1fb43bd
This was to get test coverage back to 100%.
@dhermes

dhermes commented Oct 27, 2014

Copy link
Copy Markdown
Contributor Author

Missing a few lines of test coverage so added 1fb43bd

Will wait out Travis again then merge. Somewhat surprised coveralls said coverage was unchanged.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Oct 27, 2014

Copy link
Copy Markdown

Coverage Status

Coverage remained the same when pulling 1fb43bd on dhermes:query-operator-fix-dict-random-order into f7d0441 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dhermes added a commit that referenced this pull request Oct 27, 2014
@dhermes
Merge pull request #294 from dhermes/query-operator-fix-dict-random-o…
6f26e98
…rder

Makes operator checking deterministic in Query.filter.
@dhermes
dhermes merged commit 6f26e98 into googleapis:master Oct 27, 2014
@dhermes
dhermes deleted the query-operator-fix-dict-random-order branch October 27, 2014 20:21
Alfus
Alfus reviewed Oct 27, 2014
View reviewed changes
Comment thread gcloud/datastore/test_query.py

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@silvolu silvolu mentioned this pull request Dec 17, 2014
Filters should support properties with leading/trailing whitespaces in the name. #424
Closed
urshala pushed a commit to urshala/google-cloud-python that referenced this pull request Jan 17, 2020
Alejandro Casanovas
Fix bug on auto refresh on client credentials flow googleapis#294
a93d32a
urshala pushed a commit to urshala/google-cloud-python that referenced this pull request Jan 17, 2020
Alejandro Casanovas
Fix bug: scopes was not set on client credentials flow googleapis#294
0dd14bf
parthea pushed a commit that referenced this pull request Sep 22, 2023
@gcf-owl-bot
chore(python): push cloud library docs to staging bucket for Cloud RAD (
fa640ea
#294)

Source-Link: googleapis/synthtool@694118b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ec49167c606648a063d1222220b48119c912562849a0528f35bfb592a9f72737

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
@renovate-bot
chore(deps): update dependency google-cloud-storage to v1.43.0 (#294)
8313608
parthea pushed a commit that referenced this pull request Sep 22, 2023
@renovate-bot
chore(deps): update dependency pytest to v7.2.0 (#294)
b448856
parthea pushed a commit that referenced this pull request Sep 22, 2023
@gcf-owl-bot
chore(python): exclude grpcio==1.49.0rc1 in tests [autoapprove] (#294)
37cc8e8
Source-Link: googleapis/synthtool@c4dd595
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72
parthea added a commit that referenced this pull request Sep 22, 2023
@dandhlee @parthea
docs: fix changelog header to consistent size (#294)
bcd8796
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea added a commit that referenced this pull request Oct 21, 2023
@m-strzelczyk @parthea
docs(samples): adding sample for local SSD disk (#294)
2b28bdb
* docs(samples): adding sample for local SSD disk

* Updating region tag

* Regenerating

* Updating snippets

Co-authored-by: Anthonios Partheniou <[email protected]>
parthea added a commit that referenced this pull request Oct 21, 2023
@parthea
chore: test minimum dependencies in python 3.7 (#294)
217e30d
parthea pushed a commit that referenced this pull request Oct 21, 2023
@renovate-bot @gcf-owl-bot
chore(deps): update dependency google-cloud-storage to v2 (#294)
ab6239b
* chore(deps): update dependency google-cloud-storage to v2

* 🦉 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 pull request Oct 21, 2023
@renovate-bot
chore(deps): update dependency google-auth-oauthlib to v0.7.1 (#294)
7f699d0
parthea pushed a commit that referenced this pull request Oct 21, 2023
@gcf-owl-bot
chore: regenerate samples (#294)
43cd176
* chore: update gapic-generator-python-1.4.4 with unit tests generation fixes

PiperOrigin-RevId: 475683078

Source-Link: googleapis/googleapis@df791ce

Source-Link: googleapis/googleapis-gen@ee0ce41
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWUwY2U0MWNiOWJmN2JiNTEwMDVlOTkxMDIyYjAwY2UxYmM2NjlkOCJ9

* 🦉 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 pull request Oct 21, 2023
@dandhlee @parthea
docs: fix changelog header to consistent size (#294)
f781062
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Oct 22, 2023
@gcf-owl-bot
feat: Add Cloud Trace v2 retry defaults for BatchWriteSpans (#294)
c940369
* feat: Add Cloud Trace v2 retry defaults for BatchWriteSpans

PiperOrigin-RevId: 504068544

Source-Link: googleapis/googleapis@685d359

Source-Link: googleapis/googleapis-gen@43aa9da
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDNhYTlkYWNmYzQxN2I2MjVhZDhiZTFiZWQyYTlmYzM2YzI3N2RiNiJ9

* 🦉 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 pull request Aug 21, 2025
@release-please
chore: release 2.7.0 (#294)
994e32f
🤖 I have created a release \*beep\* \*boop\*
---
## [2.7.0](https://www.github.com/googleapis/python-bigquery-storage/compare/v2.6.3...v2.7.0) (2021-09-02)


### Features

* **v1beta2:** Align ReadRows timeout with other versions of the API ([#293](https://www.github.com/googleapis/python-bigquery-storage/issues/293)) ([43e36a1](https://www.github.com/googleapis/python-bigquery-storage/commit/43e36a13ece8d876763d88bad0252a1b2421c52a))


### Documentation

* **v1beta2:** Align session length with public documentation ([43e36a1](https://www.github.com/googleapis/python-bigquery-storage/commit/43e36a13ece8d876763d88bad0252a1b2421c52a))
---


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 pull request Sep 16, 2025
@release-please @parthea
chore: release 2.7.0 (#294)
9b23a76
🤖 I have created a release \*beep\* \*boop\*
---
## [2.7.0](https://www.github.com/googleapis/python-bigquery-storage/compare/v2.6.3...v2.7.0) (2021-09-02)


### Features

* **v1beta2:** Align ReadRows timeout with other versions of the API ([#293](https://www.github.com/googleapis/python-bigquery-storage/issues/293)) ([43e36a1](https://www.github.com/googleapis/python-bigquery-storage/commit/43e36a13ece8d876763d88bad0252a1b2421c52a))


### Documentation

* **v1beta2:** Align session length with public documentation ([43e36a1](https://www.github.com/googleapis/python-bigquery-storage/commit/43e36a13ece8d876763d88bad0252a1b2421c52a))
---


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 pull request Nov 22, 2025
@release-please
chore: release 2.1.0 (#294)
b0340eb
🤖 I have created a release \*beep\* \*boop\*
---
## [2.1.0](https://www.github.com/googleapis/python-bigtable/compare/v2.0.0...v2.1.0) (2021-04-21)


### Features

* customer managed keys (CMEK) ([#249](https://www.github.com/googleapis/python-bigtable/issues/249)) ([93df829](https://www.github.com/googleapis/python-bigtable/commit/93df82998cc0218cbc4a1bc2ab41a48b7478758d))
---


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 pull request Nov 24, 2025
@software-dov
Add python_requires to generated setup.py (#294)
e36cde0
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
build(deps): [autoapprove] bump pygments from 2.13.0 to 2.15.0 (#294)
cc553fa
Source-Link: googleapis/synthtool@eaef28e
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@busunkim96
fix: revert "fix: do not error on LROs with no response or error" (#294)
034b1e3
Reverts googleapis/python-api-core#258


From @TrucHLe 
> A while ago you helped me submit this pull request for the Python LRO client library. This was about making the LRO library not throw an error when receiving an empty LRO response. It turns out that the Python LRO library has always been behaving correctly by accepting empty LRO responses. It would just throw an error if the response field is NULL (see screenshot).
>
> Since then I've consulted other LRO client library owners (@vam-google ) and it turns out that the fault was in the CCAI Insights server code. CCAI Insights was returning NULL responses instead of empty responses (more context here b/202432905). Since then the issue has been fixed in our server and has rolled out to production, so reverting the Python LRO false fix wouldn't break our code sample.
parthea added a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot @parthea
chore(python): use python 3.10 for docs build (#294)
b3cb7da
* chore(python): use python 3.10 for docs build

Source-Link: googleapis/synthtool@9ae0785
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:52210e0e0559f5ea8c52be148b33504022e1faef4e95fbe4b32d68022af2fa7e

* Use python 3.10 for docs build

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
chore(python): refactor unit / system test dependency install (#294)
eeceb75
Source-Link: googleapis/synthtool@993985f
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
build: use multiScm for Kokoro release builds (#294)
db917ab
Source-Link: googleapis/synthtool@0da1658
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5cddfe2fb5019bbf78335bc55f15bc13e18354a56b3ff46e1834f8e540807f05

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot @parthea
chore(python): update dependencies in .kokoro/docker/docs (#294)
e605748
* chore(python): update dependencies in .kokoro/docker/docs

Source-Link: googleapis/synthtool@59171c8
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2ed982f884312e4883e01b5ab8af8b6935f0216a5a2d82928d273081fc3be562

* Add constraints file for Python 3.13

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@renovate-bot
chore(deps): update all dependencies (#294)
f501652
* chore(deps): update all dependencies
parthea pushed a commit that referenced this pull request Nov 24, 2025
@release-please
chore: release 2.4.0 (#294)
0e605cf
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
Chris Rossi
fix: Fix bug with the _GlobalCacheGetBatch. (#305)
15f3c1d
@VladNF found a bug (and the solution) that caused results from calls to
the global cache to get out of synch with the futures waiting on them.

Fixes #294.
parthea pushed a commit that referenced this pull request Nov 25, 2025
@release-please
chore: release 2.4.0 (#294)
c6bfcb7
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Mar 2, 2026
@cojenco
feat: safely resume interrupted downloads (#294)
86582b0
* fix: add offset of last byte received to retry a streaming download

* add helper method _parse_generation_header

* add some object generation related logic

* revise object genertion helper method

* fix url variable scope

* handle special cases with decompressive transcoding

* fix helper method

* move to _helpers

* add support to safely resume interrupted raw downloads

* add unit tests

* add more tests

* update helper method per comments

* address comments on handling stream seek error

* address comments on moving transcoding feature
parthea pushed a commit that referenced this pull request Mar 6, 2026
@odeke-em
django: implement DatabaseIntrospection.get_constraints()
b85c527
Fixes #294
parthea pushed a commit that referenced this pull request Mar 9, 2026
@renovate-bot @asthamohta
chore(deps): update dependency importlib-resources to v5.10.1 (#294)
46bbe24
Co-authored-by: Astha Mohta <[email protected]>
parthea pushed a commit that referenced this pull request Mar 9, 2026
@cojenco
docs: clarify prefixes entity in list_blobs and link sample (#837)
53f1d6d
Improve documentation as part of 294
- clarify `prefixes` entity exists as part of the response
- add link to sample broswer ["List the objects in a bucket using a prefix filter"](https://cloud.google.com/storage/docs/samples/storage-list-files-with-prefix#storage_list_files_with_prefix-python) 

Fixes #294 🦕
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: datastore Issues related to the Datastore API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@dhermes @coveralls @jgeewax @Alfus @tseaver
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.