Skip to content

Commit f597f7f

Browse files
authored
Merge branch 'main' into feat-external-runtime-options
2 parents 838d085 + e118b02 commit f597f7f

File tree

7 files changed

+93
-17
lines changed

7 files changed

+93
-17
lines changed

google/cloud/bigquery/job/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,7 @@ def result( # type: ignore # (incompatible with supertype)
10441044
if self.state is None:
10451045
self._begin(retry=retry, timeout=timeout)
10461046

1047-
kwargs = {} if retry is DEFAULT_RETRY else {"retry": retry}
1048-
return super(_AsyncJob, self).result(timeout=timeout, **kwargs)
1047+
return super(_AsyncJob, self).result(timeout=timeout, retry=retry)
10491048

10501049
def cancelled(self):
10511050
"""Check if the job has been cancelled.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
google-cloud-bigquery==3.37.0
1+
google-cloud-bigquery==3.38.0
22
google-auth-oauthlib==1.2.2

samples/geography/requirements.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ certifi==2025.8.3
33
cffi==2.0.0
44
charset-normalizer==3.4.3
55
click===8.1.8; python_version == '3.9'
6-
click==8.2.1; python_version >= '3.10'
6+
click==8.3.0; python_version >= '3.10'
77
click-plugins==1.1.1.2
88
cligj==0.7.2
99
db-dtypes==1.4.3
@@ -12,32 +12,32 @@ geojson==3.2.0
1212
geopandas===1.0.1; python_version <= '3.9'
1313
geopandas==1.1.1; python_version >= '3.10'
1414
google-api-core==2.25.1
15-
google-auth==2.40.3
16-
google-cloud-bigquery==3.37.0
15+
google-auth==2.41.0
16+
google-cloud-bigquery==3.38.0
1717
google-cloud-bigquery-storage==2.33.1
1818
google-cloud-core==2.4.3
1919
google-crc32c==1.7.1
2020
google-resumable-media==2.7.2
2121
googleapis-common-protos==1.70.0
22-
grpcio==1.74.0
22+
grpcio==1.75.1
2323
idna==3.10
2424
munch==4.0.0
2525
mypy-extensions==1.1.0
2626
packaging==25.0
27-
pandas==2.3.2
27+
pandas==2.3.3
2828
proto-plus==1.26.1
2929
pyarrow==21.0.0
3030
pyasn1==0.6.1
3131
pyasn1-modules==0.4.2
3232
pycparser==2.23
33-
pyparsing==3.2.4
33+
pyparsing==3.2.5
3434
python-dateutil==2.9.0.post0
3535
pytz==2025.2
36-
PyYAML==6.0.2
36+
PyYAML==6.0.3
3737
requests==2.32.5
3838
rsa==4.9.1
3939
Shapely===2.0.7; python_version == '3.9'
40-
Shapely==2.1.1; python_version >= '3.10'
40+
Shapely==2.1.2; python_version >= '3.10'
4141
six==1.17.0
4242
typing-extensions==4.15.0
4343
typing-inspect==0.9.0

samples/magics/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
bigquery_magics==0.10.3
22
db-dtypes==1.4.3
3-
google.cloud.bigquery==3.37.0
3+
google.cloud.bigquery==3.38.0
44
google-cloud-bigquery-storage==2.33.1
55
ipython===8.18.1
6-
pandas==2.3.2
6+
pandas==2.3.3

samples/notebooks/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
bigquery-magics==0.10.3
22
db-dtypes==1.4.3
3-
google-cloud-bigquery==3.37.0
3+
google-cloud-bigquery==3.38.0
44
google-cloud-bigquery-storage==2.33.1
55
ipython===8.18.1; python_version == '3.9'
6-
ipython==9.5.0; python_version >= '3.10'
6+
ipython==9.6.0; python_version >= '3.10'
77
matplotlib===3.9.2; python_version == '3.9'
88
matplotlib==3.10.6; python_version >= '3.10'
9-
pandas==2.3.2
9+
pandas==2.3.3

samples/snippets/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# samples/snippets should be runnable with no "extras"
2-
google-cloud-bigquery==3.37.0
2+
google-cloud-bigquery==3.38.0

tests/unit/test_job_retry.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,3 +615,80 @@ def test_query_and_wait_retries_job_for_DDL_queries(global_time_lock):
615615
_, kwargs = calls[3]
616616
assert kwargs["method"] == "POST"
617617
assert kwargs["path"] == query_request_path
618+
619+
620+
@pytest.mark.parametrize(
621+
"result_retry_param",
622+
[
623+
pytest.param(
624+
{},
625+
id="default retry {}",
626+
),
627+
pytest.param(
628+
{
629+
"retry": google.cloud.bigquery.retry.DEFAULT_RETRY.with_timeout(
630+
timeout=10.0
631+
)
632+
},
633+
id="custom retry object with timeout 10.0",
634+
),
635+
],
636+
)
637+
def test_retry_load_job_result(result_retry_param, PROJECT, DS_ID):
638+
from google.cloud.bigquery.dataset import DatasetReference
639+
from google.cloud.bigquery.job.load import LoadJob
640+
import google.cloud.bigquery.retry
641+
642+
client = make_client()
643+
conn = client._connection = make_connection(
644+
dict(
645+
status=dict(state="RUNNING"),
646+
jobReference={"jobId": "id_1"},
647+
),
648+
google.api_core.exceptions.ServiceUnavailable("retry me"),
649+
dict(
650+
status=dict(state="DONE"),
651+
jobReference={"jobId": "id_1"},
652+
statistics={"load": {"outputRows": 1}},
653+
),
654+
)
655+
656+
table_ref = DatasetReference(project=PROJECT, dataset_id=DS_ID).table("new_table")
657+
job = LoadJob("id_1", source_uris=None, destination=table_ref, client=client)
658+
659+
with mock.patch.object(
660+
client, "_call_api", wraps=client._call_api
661+
) as wrapped_call_api:
662+
result = job.result(**result_retry_param)
663+
664+
assert job.state == "DONE"
665+
assert result.output_rows == 1
666+
667+
# Check that _call_api was called multiple times due to retry
668+
assert wrapped_call_api.call_count > 1
669+
670+
# Verify the retry object used in the calls to _call_api
671+
expected_retry = result_retry_param.get(
672+
"retry", google.cloud.bigquery.retry.DEFAULT_RETRY
673+
)
674+
675+
for call in wrapped_call_api.mock_calls:
676+
name, args, kwargs = call
677+
# The retry object is the first positional argument to _call_api
678+
called_retry = args[0]
679+
680+
# We only care about the calls made during the job.result() polling
681+
if kwargs.get("method") == "GET" and "jobs/id_1" in kwargs.get("path", ""):
682+
assert called_retry._predicate == expected_retry._predicate
683+
assert called_retry._initial == expected_retry._initial
684+
assert called_retry._maximum == expected_retry._maximum
685+
assert called_retry._multiplier == expected_retry._multiplier
686+
assert called_retry._deadline == expected_retry._deadline
687+
if "retry" in result_retry_param:
688+
# Specifically check the timeout for the custom retry case
689+
assert called_retry._timeout == 10.0
690+
else:
691+
assert called_retry._timeout == expected_retry._timeout
692+
693+
# The number of api_request calls should still be 3
694+
assert conn.api_request.call_count == 3

0 commit comments

Comments
 (0)