Title: Cloud Spanner client incorrectly handles NOT_FOUND error returned by create database · Issue #4071 · googleapis/google-cloud-python · GitHub
Open Graph Title: Cloud Spanner client incorrectly handles NOT_FOUND error returned by create database · Issue #4071 · googleapis/google-cloud-python
X Title: Cloud Spanner client incorrectly handles NOT_FOUND error returned by create database · Issue #4071 · googleapis/google-cloud-python
Description: While creating a database, is the backend returns NOT_FOUND error, the client assumes it to indicate that instance is not found and thus returns "Instance not found" error message: https://github.com/GoogleCloudPlatform/google-cloud-pyth...
Open Graph Description: While creating a database, is the backend returns NOT_FOUND error, the client assumes it to indicate that instance is not found and thus returns "Instance not found" error message: https://github.c...
X Description: While creating a database, is the backend returns NOT_FOUND error, the client assumes it to indicate that instance is not found and thus returns "Instance not found" error message: https:...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/4071
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cloud Spanner client incorrectly handles NOT_FOUND error returned by create database","articleBody":"While creating a database, is the backend returns NOT_FOUND error, the client assumes it to indicate that instance is not found and thus returns \"Instance not found\" error message:\r\nhttps://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/spanner/google/cloud/spanner_v1/database.py#L213\r\n\r\nThis is not always the case as cloud spanner can return NOT_FOUND in other scenarios. For eg in the \"CREATE INDEX ... \" ddl statement that table that the index is being created on does not exist it would return a NOT_FOUND. I think the fix would be to just pass the error message returned by the rpc to the user.\r\n\r\nThis can be reproduced using:\r\n```python\r\nfrom google.cloud import spanner\r\n\r\n\"\"\"Creates a database and tables for pattern 1 sample data.\"\"\"\r\n\r\nspanner_client = spanner.Client()\r\n\r\ninstance = spanner_client.instance(\"test-instance\")\r\n\r\n\r\n\r\ndatabase = instance.database(\"bitemporal_pattern1\", ddl_statements=[\r\n\r\n \"\"\"CREATE TABLE MyTable (\r\n\r\n Id String(36) NOT NULL,\r\n\r\n Field1 STRING(36) NOT NULL\r\n\r\n) PRIMARY KEY (Id)\"\"\"\r\n\r\n,\r\n\r\n\"\"\"CREATE INDEX IDX ON yTable (Field1)\"\"\"\r\n\r\n])\r\n\r\n\r\n\r\noperation = database.create()\r\n\r\n\r\n\r\nprint('Waiting for operation to complete...')\r\n\r\noperation.result()\r\n```","author":{"url":"https://github.com/vkedia","@type":"Person","name":"vkedia"},"datePublished":"2017-09-27T00:34:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4071/google-cloud-python/issues/4071"}
| 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:4c46f717-9464-50fd-c584-1ea45ebc3327 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9754:8709C:F50E0D:14B5E7E:6A4D8537 |
| html-safe-nonce | 749d386eebbfc8a51e3403067662e27e9ed867654da3d91dd213a3fffffce985 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzU0Ojg3MDlDOkY1MEUwRDoxNEI1RTdFOjZBNEQ4NTM3IiwidmlzaXRvcl9pZCI6Ijc3MTU2MzM3MjUxMTE2MzMyMDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bca706321097e67d88ac8352393b4f0f11cf30a4071b91cb06ca54805a840371 |
| hovercard-subject-tag | issue:260810764 |
| 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/4071/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c63927a4864fa04afe18f02cba16bd4c62c42d40f84d55385d3b34bd762ecc51/googleapis/google-cloud-python/issues/4071 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c63927a4864fa04afe18f02cba16bd4c62c42d40f84d55385d3b34bd762ecc51/googleapis/google-cloud-python/issues/4071 |
| og:image:alt | While creating a database, is the backend returns NOT_FOUND error, the client assumes it to indicate that instance is not found and thus returns "Instance not found" error message: https://github.c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vkedia |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6bf61c909482ec3072ef5d7a5a28f2a9d214788c9a44793eca1960048cb05ae |
| 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 | 6702a58b419a792226bd21ef0fb1bcb318bbcaa3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width