Skip to content
Permalink
Browse files
feat: include key metadata in Job representation (#964)
  • Loading branch information
plamut committed Sep 13, 2021
1 parent 9157537 commit acca1cb7baaa3b00508246c994ade40314d421c3
Showing with 14 additions and 0 deletions.
  1. +8 −0 google/cloud/bigquery/job/base.py
  2. +6 −0 tests/unit/job/test_base.py
@@ -722,6 +722,14 @@ def cancelled(self):
and self.error_result.get("reason") == _STOPPED_REASON
)

def __repr__(self):
result = (
f"{self.__class__.__name__}<"
f"project={self.project}, location={self.location}, id={self.job_id}"
">"
)
return result


class _JobConfig(object):
"""Abstract base class for job configuration objects.
@@ -1043,6 +1043,12 @@ def test_cancelled_w_error_result_w_stopped(self):

self.assertTrue(job.cancelled())

def test_repr(self):
client = _make_client(project="project-foo")
job = self._make_one("job-99", client)
job._properties.setdefault("jobReference", {})["location"] = "ABC"
assert repr(job) == "_AsyncJob<project=project-foo, location=ABC, id=job-99>"


class Test_JobConfig(unittest.TestCase):
JOB_TYPE = "testing"

0 comments on commit acca1cb

Please sign in to comment.