Skip to content

Commit d4a5eaf

Browse files
committed
Do not set job timeout extra property if None
1 parent 4383cfe commit d4a5eaf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎google/cloud/bigquery/job/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ def job_timeout_ms(self, value):
219219
)
220220

221221
""" Docs indicate a string is expected by the API """
222-
self._properties["jobTimeoutMs"] = str(value)
222+
if value is not None:
223+
self._properties["jobTimeoutMs"] = str(value)
223224

224225
@property
225226
def labels(self):

‎tests/unit/job/test_base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,3 +1320,9 @@ def test_job_timeout_ms(self):
13201320
# Confirm that integers get converted to strings.
13211321
job_config.job_timeout_ms = 5000
13221322
assert job_config.job_timeout_ms == "5000" # int is converted to string
1323+
1324+
def test_job_timeout_is_none_when_set_none(self):
1325+
job_config = self._make_one()
1326+
job_config.job_timeout_ms = None
1327+
# Confirm value is None and not literal string 'None'
1328+
assert job_config.job_timeout_ms is None

0 commit comments

Comments
 (0)