Title: Query error when trying to insert in partitioned table · Issue #4073 · googleapis/google-cloud-python · GitHub
Open Graph Title: Query error when trying to insert in partitioned table · Issue #4073 · googleapis/google-cloud-python
X Title: Query error when trying to insert in partitioned table · Issue #4073 · googleapis/google-cloud-python
Description: Using following code to write in an existing daily partitioned table: bigquery_client = bigquery.Client(project=self.project_id) dataset = bigquery_client.dataset(self.destination_dataset) destination_table_with_day = "table$20170927" sq...
Open Graph Description: Using following code to write in an existing daily partitioned table: bigquery_client = bigquery.Client(project=self.project_id) dataset = bigquery_client.dataset(self.destination_dataset) destinat...
X Description: Using following code to write in an existing daily partitioned table: bigquery_client = bigquery.Client(project=self.project_id) dataset = bigquery_client.dataset(self.destination_dataset) destinat...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/4073
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Query error when trying to insert in partitioned table","articleBody":"Using following code to write in an existing daily partitioned table:\r\n```\r\nbigquery_client = bigquery.Client(project=self.project_id)\r\ndataset = bigquery_client.dataset(self.destination_dataset)\r\ndestination_table_with_day = \"table$20170927\"\r\nsql = \"\"\"\r\n #standardSQL\r\n ...\r\n \"\"\"\r\n\r\ntable = dataset.table(destination_table_with_day)\r\ntable.partitioning_type = \"DAY\"\r\nquery = client.run_async_query(str(uuid.uuid4()), sql)\r\nquery.destination = table\r\nquery.write_disposition = 'WRITE_TRUNCATE'\r\nquery.begin()\r\nquery.result()\r\n```\r\n\r\nI expected similar result as the CLI with\r\n`bq query --use_legacy_sql=false --replace --destination_table 'dataset.table$20170927' \"...\"` which works flawlessly\r\n\r\nBut it returned `ERROR - 400 Partitioning specification must be provided in order to create partitioned table`\r\n\r\nI suspect that some parameters are missing that would result in this error such as https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.timePartitioning.type\r\n\r\nI'm not really that fluent in Python so I couldn't find out that it's the problem is the way I use the SDK or in the SDK. \r\n\r\nI didn't find any sample related on that case inside https://github.com/GoogleCloudPlatform/python-docs-samples but I saw https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2729 that could be related somehow.\r\n","author":{"url":"https://github.com/Kayrnt","@type":"Person","name":"Kayrnt"},"datePublished":"2017-09-27T15:50:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4073/google-cloud-python/issues/4073"}
| 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:2c4c91e3-b2c5-cd9b-ae51-9506b3a5037c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1EA:2E1914:5C050D:7BE915:6A4D3F9F |
| html-safe-nonce | 36b9f8e4224ed3ba8667630273f91446ca8d00354ee90de2f75e17796f9524c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUVBOjJFMTkxNDo1QzA1MEQ6N0JFOTE1OjZBNEQzRjlGIiwidmlzaXRvcl9pZCI6IjM2MDU1Njc4Mzc4MTEwNjQ3MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b4c67bd9108c8f238ce82c12c72a96b8a0111c29d7f38838fb26bdd3b5ec0f8d |
| hovercard-subject-tag | issue:261025962 |
| 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/4073/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7dd9173f00feed665866e8ead8adfbafb4e2b855aeec5cf8eac643d04774c0d1/googleapis/google-cloud-python/issues/4073 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7dd9173f00feed665866e8ead8adfbafb4e2b855aeec5cf8eac643d04774c0d1/googleapis/google-cloud-python/issues/4073 |
| og:image:alt | Using following code to write in an existing daily partitioned table: bigquery_client = bigquery.Client(project=self.project_id) dataset = bigquery_client.dataset(self.destination_dataset) destinat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Kayrnt |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| 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 | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width