Skip to content

Commit 269ed8e

Browse files
committed
cr
1 parent c99036b commit 269ed8e

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

packages/google-cloud-bigquery/google/cloud/bigquery/_job_helpers.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def query_and_wait(
514514
# Some API parameters aren't supported by the jobs.query API. In these
515515
# cases, fallback to a jobs.insert call.
516516
if not _supported_by_jobs_query(request_body):
517-
iterator = _wait_or_cancel(
517+
return _wait_or_cancel(
518518
query_jobs_insert(
519519
client=client,
520520
query=query,
@@ -533,11 +533,9 @@ def query_and_wait(
533533
retry=retry,
534534
page_size=page_size,
535535
max_results=max_results,
536+
query_results_format=query_results_format,
536537
callback=callback,
537538
)
538-
if query_results_format is not None:
539-
iterator._query_results_format = query_results_format
540-
return iterator
541539

542540
path = _to_query_path(project)
543541

@@ -601,18 +599,16 @@ def do_query():
601599
# remaining pages) by waiting for the query to finish and calling
602600
# client._list_rows_from_query_results directly. Need to update
603601
# RowIterator to fetch destination table via the job ID if needed.
604-
iterator = _wait_or_cancel(
602+
return _wait_or_cancel(
605603
_to_query_job(client, query, job_config, response),
606604
api_timeout=api_timeout,
607605
wait_timeout=wait_timeout,
608606
retry=retry,
609607
page_size=page_size,
610608
max_results=max_results,
609+
query_results_format=query_results_format,
611610
callback=callback,
612611
)
613-
if query_results_format is not None:
614-
iterator._query_results_format = query_results_format
615-
return iterator
616612

617613
if "dryRun" not in request_body:
618614
callback(
@@ -706,6 +702,7 @@ def _wait_or_cancel(
706702
page_size: Optional[int],
707703
max_results: Optional[int],
708704
*,
705+
query_results_format: Optional[str] = None,
709706
callback: Callable = lambda _: None,
710707
) -> table.RowIterator:
711708
"""Wait for a job to complete and return the results.
@@ -750,6 +747,7 @@ def _wait_or_cancel(
750747
ended=job.ended,
751748
)
752749
)
750+
query_results._query_results_format = query_results_format
753751
return query_results
754752
except Exception:
755753
# Attempt to cancel the job since we can't return the results.

packages/google-cloud-bigquery/google/cloud/bigquery/table.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,11 +2329,6 @@ def _download_arrow_from_job_id(
23292329
if job_complete and offset >= total_rows:
23302330
return
23312331

2332-
options = [
2333-
("grpc.max_receive_message_length", 128 * 1024 * 1024),
2334-
("grpc.keepalive_time_ms", 30000),
2335-
]
2336-
23372332
if bqstorage_client is None:
23382333
if self.client is None:
23392334
raise ValueError("RowIterator client is None.")

0 commit comments

Comments
 (0)