Skip to content

Commit ac612e6

Browse files
authored
Merge pull request #3005 from tseaver/3003-bigquery-job_status_via_property
Check running status via 'job' property. Merging without waiting for the speech fix to land.
2 parents 5d5c2f7 + 5238b42 commit ac612e6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

bigquery/google/cloud/bigquery/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def run(self, client=None):
355355
:param client: the client to use. If not passed, falls back to the
356356
``client`` stored on the current dataset.
357357
"""
358-
if self._job is not None:
358+
if self.job is not None:
359359
raise ValueError("Query job is already running.")
360360

361361
client = self._require_client(client)

bigquery/unit_tests/test_query.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,15 @@ def test_run_w_already_has_job(self):
394394
with self.assertRaises(ValueError):
395395
query.run()
396396

397+
def test_run_w_already_has_job_in_properties(self):
398+
JOB_ID = 'JOB_ID'
399+
conn = _Connection()
400+
client = _Client(project=self.PROJECT, connection=conn)
401+
query = self._make_one(self.QUERY, client)
402+
query._properties['jobReference'] = {'jobId': JOB_ID}
403+
with self.assertRaises(ValueError):
404+
query.run()
405+
397406
def test_run_w_bound_client(self):
398407
PATH = 'projects/%s/queries' % self.PROJECT
399408
RESOURCE = self._makeResource(complete=False)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy