Skip to content

Commit

Permalink
fix: do not set job timeout extra property if None
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwant committed Aug 5, 2024
1 parent 4383cfe commit f76a4fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion google/cloud/bigquery/job/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ def job_timeout_ms(self, value):
)

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

@property
def labels(self):
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/job/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,3 +1320,9 @@ def test_job_timeout_ms(self):
# Confirm that integers get converted to strings.
job_config.job_timeout_ms = 5000
assert job_config.job_timeout_ms == "5000" # int is converted to string

def test_job_timeout_is_none_when_set_none(self):
job_config = self._make_one()
job_config.job_timeout_ms = None
# Confirm value is None and not literal string 'None'
assert job_config.job_timeout_ms is None

0 comments on commit f76a4fe

Please sign in to comment.