| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Shall we also ditch _get_dataset_id_from_keys and just rely on this behavior? |
Sorry, something went wrong.
|
_get_dataset_id_from_keys is used by datastore.get, too, and is used to figure out which dataset_id to use in datastore.put and datastore.delete when no batch / transaction is already in play. |
Sorry, something went wrong.
|
OK so let's not remove, but it doesn't make sense to check them at the beginning and then again when each Key / Entity is passed to Batch.put() / Batch.delete(). Proposal:
|
Sorry, something went wrong.
|
SGTM: For consistency, get() should work the same way. |
Sorry, something went wrong.
|
But get() is not tied to a batch. How do you mean the same way? |
Sorry, something went wrong.
|
I just mean that the API should be consistent: get() should take an optional dataset_id, and fall back to the implicit one, rather than deriving it from the keys (it should still check the keys to ensure that they all match). |
Sorry, something went wrong.
|
SGTM |
Sorry, something went wrong.
|
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 datastore.get() / datastore.put() / datastore.delete(), then we use the value set on the batch or transaction. |
Sorry, something went wrong.
|
RE: Doing the right thing comparing dataset_ids, instead of waiting on #528, how do you feel about just moving regression.datastore._compare_dataset_ids into gcloud.datastore.api? |
Sorry, something went wrong.
|
RE: variant of implicit, that seems to be the right move. Reviewing now. |
Sorry, something went wrong.
|
I forgot regression.datastore._compare_dataset_ids was there, and implemented a stripped-down variant in Batch._match_dataset_id (1b87a7e) |
Sorry, something went wrong.
|
Yes I just saw it in the review. Unfortunately it would gave false positives like e~foo == s~foo and s~foo == s~notfoo~foo. (These are not likely to be possible values in the wild, but better safe than sorry.) |
Sorry, something went wrong.
|
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 ~: why else would they have picked it to delimit the "location"-based IDs? At any rate, we could move the regression.datastore_compare_dataset_ids code into helpers, and call it from within _match_dataset_id (which wants to raise an error). |
Sorry, something went wrong.
|
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 helpers SGTM, take a peek at |
Sorry, something went wrong.
|
Are you working to merge dhermes/google-cloud-python@90d5063? If so, we should update _match_dataset_id to use your helper function afterwards. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
I think you're correct that without pathological things like key = Key('Foo')
key._dataset_id = Nonethe 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, api.delete() will create a new Batch with dataset_id = 'foo' and then will result in an error when Batch.delete() is called on this new batch. This is why the ordering
is necessary. |
Sorry, something went wrong.
I think the last is a "can't get there" case, because keys will always have a dataset_id. If that is so, I can update the PR to match. |
Sorry, something went wrong.
|
It's not the Keys we're worried about, it's the Batch (more than just Key uses the default). See the scenario I mentioned below the 1st line above. |
Sorry, something went wrong.
Incorporates feedback from @dhermes: - #552 (comment) - #552 (comment)
Instead, caller passes only the first key. Incorporates feedback from @dhermes: - #552 (comment)
|
@tseaver Everything looks good except moving _match_dataset_id to helpers and using the implementation / tests from dhermes@90d5063 |
Sorry, something went wrong.
|
LGTM |
Sorry, something went wrong.
…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>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* chore: allow releases on previous major versions * 🦉 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>
* updated CHANGELOG.md [ci skip] * updated setup.py Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Dov Shlachter <dovs@google.com>
Fixes #540 Co-authored-by: Anthonios Partheniou <partheniou@google.com>
…re bug. (#552) * fix: Using end_cursor instead of skipped_cursor in Iterator to fix rare bug. * 🦉 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: Daniel Sanche <sanche@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>
* updated CHANGELOG.md [ci skip] * updated setup.cfg [ci skip] * updated setup.py Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* Directly subclass generated PublisherClient * Directly subclass generated SubscriberClient * Remove unneded GAPIC helper * Remove pytype There are no real advantages over mypy, but at the same time several downsides such as being slow, producing more false positives, etc. * Re-enable mypy_samples nox session * Convert a comment to docstring in publisher client * Add api property back, but deprecated * Assure that mypy_samples is not commented out * Remove redundant type hint casts * Disable mypy_samples session until blockers resolved
Disable renovate PRs on the .pre-commit-config.yaml which is templated from synthtool. https://docs.renovatebot.com/configuration-options/#ignorepaths Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Mon Mar 15 09:05:39 2021 -0600 Source-Repo: googleapis/synthtool Source-Sha: 2c54c473779ea731128cea61a3a6c975a08a5378 Source-Link: googleapis/synthtool@2c54c47
| Back | FazBrowse Home | New Git URL |
Fixes #447.