-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Require that keys for 'put' / 'delete' match the 'dataset_id' of the batch #552
Require that keys for 'put' / 'delete' match the 'dataset_id' of the batch #552
Conversation
Shall we also ditch |
|
OK so let's not remove, but it doesn't make sense to check them at the beginning and then again when each Proposal:
|
SGTM: For consistency, |
But |
I just mean that the API should be consistent: |
SGTM |
I'm adding a variant on the "inferred connection / dataset ID" bit: if there is an active batch or transaction, and you don't pass them to |
RE: Doing the right thing comparing |
RE: variant of implicit, that seems to be the right move. Reviewing now. |
""" | ||
if not entities: | ||
return | ||
|
||
connection = connection or _implicit_environ.CONNECTION | ||
connection = _require_connection(connection) | ||
dataset_id = _require_dataset_id(dataset_id) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I forgot |
Yes I just saw it in the review. Unfortunately it would gave false positives like |
For a given "project ID" (the un-prefixed dataset ID), is it possible to have more than one prefix? I'm pretty sure that the project IDs themselves will never have an embedded At any rate, we could move the |
I'm fairly certain the two cases I described are impossible, but the extra effort required is minimal since I've already written the code and the tests. Moving to |
Are you working to merge dhermes/google-cloud-python@90d5063? If so, we should update |
I am holding off on it until #528 has some sort of resolution, since it doesn't solve an actual problem, just gives "nice" behavior. |
I think you're correct that without pathological things like key = Key('Foo')
key._dataset_id = None the last one can't occur. I spoke too soon in my recommendation. As implemented, the following will fail but should not: from gcloud import datastore
datastore.set_defaults(dataset_id='foo')
k = Key('Kind', 10, dataset_id='bar')
datastore.delete([k]) With this, This is why the ordering
is necessary. |
I think the last is a "can't get there" case, because keys will always have a |
It's not the |
...before falling back to the implicit defaults.
If not passed, fall back to value inferred from batch / environment.
@dhermes: d5d64 adds the keys back per your comment. |
"""Infer a dataset ID from the environment, if not passed explicitly. | ||
|
||
Order or precedence: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@tseaver Sorry for the email spam, I accidentally commented on the commit and then moved the feedback to the PR. |
Incorporates feedback from @dhermes: - #552 (comment) - #552 (comment)
Instead, caller passes only the first key. Incorporates feedback from @dhermes: - #552 (comment)
@dhermes no worries. |
@tseaver Everything looks good except moving |
@dhermes PTAL |
LGTM |
…h_branch Require that keys for 'put' / 'delete' match the 'dataset_id' of the batch
…552) Source-Link: googleapis/synthtool@8e55b32 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c6c965a4bf40c19011b11f87dbc801a66d3a23fbc6704102be064ef31c51f1c3
* 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: Anthonios Partheniou <partheniou@google.com>
* docs: Minor formatting chore: Update gapic-generator-python to v1.11.5 build: Update rules_python to 0.24.0 PiperOrigin-RevId: 563436317 Source-Link: googleapis/googleapis@42fd37b Source-Link: googleapis/googleapis-gen@280264c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjgwMjY0Y2EwMmZiOTMxNmI0MjM3YTk2ZDBhZjFhMjM0M2E4MWE1NiJ9 * 🦉 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>
Fixes #447.