Title: Batch (and Transaction) dataset_id should match that of Key / Query objects when added · Issue #447 · googleapis/google-cloud-python · GitHub
Open Graph Title: Batch (and Transaction) dataset_id should match that of Key / Query objects when added · Issue #447 · googleapis/google-cloud-python
X Title: Batch (and Transaction) dataset_id should match that of Key / Query objects when added · Issue #447 · googleapis/google-cloud-python
Description: Proposed fix: Do not ask for dataset_id in the constructor and instead gather it from the keys and queries used in the transaction. This may require implementing #495 and will require removing the self.begin() call from Transaction.__ent...
Open Graph Description: Proposed fix: Do not ask for dataset_id in the constructor and instead gather it from the keys and queries used in the transaction. This may require implementing #495 and will require removing the ...
X Description: Proposed fix: Do not ask for dataset_id in the constructor and instead gather it from the keys and queries used in the transaction. This may require implementing #495 and will require removing the ...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Batch (and Transaction) dataset_id should match that of Key / Query objects when added","articleBody":"Proposed fix:\n\nDo not ask for `dataset_id` in the constructor and instead gather it from the keys and queries used in the transaction.\n\nThis may require implementing #495 and **will** require removing the `self.begin()` [call](https://github.com/GoogleCloudPlatform/gcloud-python/blob/8faba35a266cd6280f125adf6035f902a07a26e4/gcloud/datastore/transaction.py#L246) from `Transaction.__enter__`. (Can't begin until a query or entity is encountered.)\n\n**Title** was: \"Transaction does not rollback correctly when multiple datasets involved\"\n\n---\n\nWitness the following code:\n\n``` python\n\u003e\u003e\u003e from gcloud import datastore\n\u003e\u003e\u003e cnxn = datastore.get_connection()\n\u003e\u003e\u003e dataset1 = cnxn.dataset('PROJ1')\n\u003e\u003e\u003e dataset2 = cnxn.dataset('PROJ2')\n\u003e\u003e\u003e e1 = dataset1.entity('foo')\n\u003e\u003e\u003e e2 = dataset2.entity('foo')\n\u003e\u003e\u003e e1['bar'] = e2['bar'] = 0\n\u003e\u003e\u003e e1.save()\n\u003cEntity[{'kind': u'foo', 'id': 5686683802533888L}] {'bar': 0}\u003e\n\u003e\u003e\u003e e2.save()\n\u003cEntity[{'kind': u'foo', 'id': 5659313586569216L}] {'bar': 0}\u003e\n\u003e\u003e\u003e with dataset1.transaction():\n... e1.delete()\n... e2.delete()\n... \n\u003e\u003e\u003e e1_still = dataset1.get_entity(e1.key())\n\u003e\u003e\u003e e1_still is None\nTrue\n\u003e\u003e\u003e e2_still = dataset2.get_entity(e2.key())\n\u003e\u003e\u003e e2_still\n\u003cEntity[{'kind': u'foo', 'id': 5659313586569216L}] {u'bar': 0L}\u003e\n```\n","author":{"url":"https://github.com/dhermes","@type":"Person","name":"dhermes"},"datePublished":"2014-12-19T06:11:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/447/google-cloud-python/issues/447"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2e5dd11a-e2a3-463d-069f-5d297d5406e5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA04:2EEEB5:E4D73C:138934B:6A4D5D03 |
| html-safe-nonce | e057af9447b462759573dde874d30aedb417981127cecc569e00b80f4eaf94ff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTA0OjJFRUVCNTpFNEQ3M0M6MTM4OTM0Qjo2QTRENUQwMyIsInZpc2l0b3JfaWQiOiIyNzQ2NzQzNDE1NjM4OTQwOTMxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7505a6b09fa488e4f1d937eae36a805724bf8558da8d6aa731e81a47e4cc0633 |
| hovercard-subject-tag | issue:52451184 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/33d6f08278f6babd4ddf41a4bff3cd5c38e01f60ee12c288b4532c1cbb573000/googleapis/google-cloud-python/issues/447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/33d6f08278f6babd4ddf41a4bff3cd5c38e01f60ee12c288b4532c1cbb573000/googleapis/google-cloud-python/issues/447 |
| og:image:alt | Proposed fix: Do not ask for dataset_id in the constructor and instead gather it from the keys and queries used in the transaction. This may require implementing #495 and will require removing the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dhermes |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2a1443ff9733a3016431263ea73c93d8fe00c195eb4a7670ac30e7848f045441 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3bdd3157ea1f0fd738d408eceeead721acf1dc3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width