Skip to content

query.fetch() fails if GOOGLE_CLOUD_DISABLE_GRPC is set #124

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

Closed
tomthorogood opened this issue Nov 30, 2020 · 5 comments · Fixed by #136
Closed

query.fetch() fails if GOOGLE_CLOUD_DISABLE_GRPC is set #124

tomthorogood opened this issue Nov 30, 2020 · 5 comments · Fixed by #136
Assignees
Labels
api: datastore Issues related to the googleapis/python-datastore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tomthorogood
Copy link

This new behavior causes an error: run_query() got an unexpected keyword argument 'request' because when the GOOGLE_CLOUD_DISABLE_GRPC environment variable is set (which is a requirement in some runtimes, e.g., when using gunicorn with gevent), the underlying HTTPDatastoreAPI#run_query method does not accept a request parameter.

Example:

# run_query.py

from google.cloud import datastore

client = datastore.Client()  # Assuming an auth'd environment
results = [entity for entity in client.query(kind="Foo").fetch()]

I feel like this can be fixed by updating the signature for the HTTPDatastoreAPI#run_query to accept request and only subsequently build the request object if it's not passed in, so that the signatures match for all implementations.

@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-datastore API. label Nov 30, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Dec 1, 2020
@HemangChothani HemangChothani added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Dec 8, 2020
@HemangChothani HemangChothani self-assigned this Dec 8, 2020
@tseaver
Copy link
Contributor

tseaver commented Dec 9, 2020

@tomthorogood Thanks for the report!

@crwilcox We need to set up CI (maybe periodic, rather than precommit?) to exercise the library with GOOGLE_CLOUD_DISABLE_GRPC set.

@crwilcox
Copy link
Contributor

crwilcox commented Dec 9, 2020

#133

@tseaver
Copy link
Contributor

tseaver commented Dec 9, 2020

Note that we have a broader issue here: all of the methods of the HTTPDatastoreAPI need to be updated to match the request-only pattern of the new GRPC API.

@tseaver
Copy link
Contributor

tseaver commented Dec 9, 2020

The HTTPDatastoreAPI is also missing reserve_ids. :(

tseaver added a commit that referenced this issue Dec 9, 2020
crwilcox pushed a commit that referenced this issue Dec 9, 2020
* tests: refactor to helpers for repeated tests

* fix: update 'HTTPDatastoreAPI.allocate_ids' to follow request-only pattern

Toward #124

* fix: add missing 'HTTPDatastoreAPI.reserve_ids' method

Closes #134.

* fix: update 'HTTPDatastoreAPI.rollback' to follow request-only pattern

Toward #124

* fix: update 'HTTPDatastoreAPI.commit' to follow request-only pattern

Toward #124

* fix: update 'HTTPDatastoreAPI.begin_transaction' to follow request-only pattern

Toward #124

* fix: update 'HTTPDatastoreAPI.run_query' to follow request-only pattern

Toward #124

* fix: update 'HTTPDatastoreAPI.lookup' to follow request-only pattern

Toward #124

* fix: add 'retry' / 'timeout' args to HTTPDatastoreAPI methods

Closes #124.

* chore: lint

* tests: run systests also w/ GRPC disabled.

Closes #133.
@tomthorogood
Copy link
Author

I am so sorry, I only just saw that this was resolved. Thank you so much! I really appreciate it.

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 googleapis/python-datastore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
5 participants