Title: BigQuery: structs not populated correctly in query parameters · Issue #2887 · googleapis/google-cloud-python · GitHub
Open Graph Title: BigQuery: structs not populated correctly in query parameters · Issue #2887 · googleapis/google-cloud-python
X Title: BigQuery: structs not populated correctly in query parameters · Issue #2887 · googleapis/google-cloud-python
Description: See documentation for structs in query parameters: https://cloud.google.com/bigquery/querying-data#using_structs_in_parameterized_queries Stacktrace $ python sync_query_params.py struct 7 hello Traceback (most recent call last): File "sy...
Open Graph Description: See documentation for structs in query parameters: https://cloud.google.com/bigquery/querying-data#using_structs_in_parameterized_queries Stacktrace $ python sync_query_params.py struct 7 hello Tra...
X Description: See documentation for structs in query parameters: https://cloud.google.com/bigquery/querying-data#using_structs_in_parameterized_queries Stacktrace $ python sync_query_params.py struct 7 hello Tra...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/2887
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BigQuery: structs not populated correctly in query parameters","articleBody":"See documentation for structs in query parameters:\r\nhttps://cloud.google.com/bigquery/querying-data#using_structs_in_parameterized_queries\r\n\r\n- Stacktrace\r\n\r\n```\r\n$ python sync_query_params.py struct 7 hello\r\nTraceback (most recent call last):\r\n File \"sync_query_params.py\", line 204, in \u003cmodule>\r\n sync_query_struct_params(args.x, args.y)\r\n File \"sync_query_params.py\", line 139, in sync_query_struct_params\r\n query_results.run()\r\n File \"/Users/swast/src/google-cloud-python/bigquery/google/cloud/bigquery/query.py\", line 360, in run\r\n method='POST', path=path, data=self._build_resource())\r\n File \"/Users/swast/venvs/bq-dml/lib/python3.5/site-packages/google/cloud/_http.py\", line 335, in api_request\r\n error_info=method + ' ' + url)\r\ngoogle.cloud.exceptions.BadRequest: 400 Invalid query parameter type (POST https://www.googleapis.com/bigquery/v2/projects/cloud-samples-tests/queries)\r\n```\r\n\r\n- Code sample\r\n\r\nhttps://github.com/GoogleCloudPlatform/python-docs-samples/blob/tswast-bq/bigquery/cloud-client/sync_query_params.py#L129\r\n\r\nThe google-cloud-bigquery library produces a resource that looks like:\r\n\r\n```\r\n{\r\n 'name': 'struct_value',\r\n 'parameterValue': {\r\n 'structValues': {'y': 'hello', 'x': '7'}\r\n },\r\n 'parameterType': {\r\n 'structTypes': [{'type': 'INT64', 'name': 'x'}, {'type': 'STRING', 'name': 'y'}]\r\n }\r\n}\r\n```\r\n\r\nThe API expects a resource that looks like:\r\n\r\n```\r\n{\r\n \"name\": \"struct_value\",\r\n \"parameterType\": {\r\n \"type\": \"STRUCT\",\r\n \"structTypes\": [\r\n {\r\n \"name\": \"x\",\r\n \"type\": {\r\n \"type\": \"INT64\"\r\n }\r\n },\r\n {\r\n \"name\": \"y\",\r\n \"type\": {\r\n \"type\": \"STRING\"\r\n }\r\n }\r\n ]\r\n },\r\n \"parameterValue\": {\r\n \"structValues\": {\r\n \"x\": {\r\n \"value\": \"1\"\r\n },\r\n \"y\": {\r\n \"value\": \"foo\"\r\n }\r\n }\r\n }\r\n }\r\n```\r\n\r\nNotice the missing `{ \"value\": \"my-value\" }` in the `structValues` in the request object produced by this library.","author":{"url":"https://github.com/tswast","@type":"Person","name":"tswast"},"datePublished":"2016-12-20T00:51:37Z","url":"https://github.com/googleapis/google-cloud-python/issues/2887"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:c5492c33-fe22-2679-034b-084d499de26f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E696:3C7AB6:5BA9F:7762B:6AFE50E3 |
| html-safe-nonce | dce4f51591177d11931e388a6458477cdff69d8d9bac63fc00cf2dbfd03d1a36 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjk2OjNDN0FCNjo1QkE5Rjo3NzYyQjo2QUZFNTBFMyIsInZpc2l0b3JfaWQiOiI1Mjk1MzQ4Njc5NDkyNjUzMjgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5570b8cbeb3b1d985756a703e4c7b95086ecf2cb34f302b264051c913ce41816 |
| hovercard-subject-tag | issue:196558749 |
| 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/2887/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b584e41b3a0b7641dbc4304fcc3958c3fab48b7620ec6867eccea94a9f56dcb5/googleapis/google-cloud-python/issues/2887 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b584e41b3a0b7641dbc4304fcc3958c3fab48b7620ec6867eccea94a9f56dcb5/googleapis/google-cloud-python/issues/2887 |
| og:image:alt | See documentation for structs in query parameters: https://cloud.google.com/bigquery/querying-data#using_structs_in_parameterized_queries Stacktrace $ python sync_query_params.py struct 7 hello Tra... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tswast |
| hostname | github.com |
| expected-hostname | github.com |
| None | 894d3c8b932306ed8425e8dcbe0c1089667e487c5fe7b8a05d17e7b685207429 |
| 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 | 44570ad53e12be09be8000af683c29166c4007cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width