[
https://issues.apache.org/jira/browse/BEAM-6553?focusedWorklogId=195875&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-195875
]
ASF GitHub Bot logged work on BEAM-6553:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Feb/19 19:16
Start Date: 07/Feb/19 19:16
Worklog Time Spent: 10m
Work Description: chamikaramj commented on pull request #7655:
[BEAM-6553] A Python SDK sink that supports File Loads into BQ
URL: https://github.com/apache/beam/pull/7655#discussion_r254813655
##########
File path: sdks/python/apache_beam/io/gcp/bigquery_tools.py
##########
@@ -257,24 +260,67 @@ def get_query_location(self, project_id, query,
use_legacy_sql):
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
- def _insert_load_job(self, project_id, job_id, table_reference, source_uris,
- schema=None):
+ def _insert_copy_job(self,
+ project_id,
+ job_id,
+ from_table_reference,
+ to_table_reference,
+ create_disposition=None,
+ write_disposition=None):
+ reference = bigquery.JobReference()
+ reference.jobId = job_id
+ reference.projectId = project_id
+ request = bigquery.BigqueryJobsInsertRequest(
+ projectId=project_id,
+ job=bigquery.Job(
+ configuration=bigquery.JobConfiguration(
+ copy=bigquery.JobConfigurationTableCopy(
+ destinationTable=to_table_reference,
+ sourceTable=from_table_reference,
+ createDisposition=create_disposition,
+ writeDisposition=write_disposition,
+ )
+ ),
+ jobReference=reference,
+ )
+ )
+
+ logging.info("Inserting job request: %s", request)
+ response = self.client.jobs.Insert(request)
+ logging.info("Response was %s", response)
+ return response.jobReference
+
+ @retry.with_exponential_backoff(
+ num_retries=MAX_RETRIES,
+ retry_filter=retry.retry_on_server_errors_and_timeout_filter)
+ def _insert_load_job(self,
+ project_id,
+ job_id,
+ table_reference,
+ source_uris,
+ schema=None,
+ write_disposition=None,
+ create_disposition=None):
reference = bigquery.JobReference(jobId=job_id, projectId=project_id)
request = bigquery.BigqueryJobsInsertRequest(
- projectId=table_reference.project_id,
Review comment:
Retry failures ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 195875)
Time Spent: 2.5h (was: 2h 20m)
> A BigQuery sink thta is SDK-implemented and supports file loads in Python
> -------------------------------------------------------------------------
>
> Key: BEAM-6553
> URL: https://issues.apache.org/jira/browse/BEAM-6553
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core
> Reporter: Pablo Estrada
> Assignee: Pablo Estrada
> Priority: Major
> Labels: triaged
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)