Skip to content

Commit

Permalink
Merge pull request #1120 from tseaver/bigquery-rename_run_query_to_in…
Browse files Browse the repository at this point in the history
…dicate_async

Rename 'RunQueryJob'->'RunQueryAsyncJob'.
  • Loading branch information
tseaver committed Aug 31, 2015
2 parents dd35f25 + c95a6b8 commit d8d58ad
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions gcloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from gcloud.bigquery.job import CopyJob
from gcloud.bigquery.job import ExtractTableToStorageJob
from gcloud.bigquery.job import LoadTableFromStorageJob
from gcloud.bigquery.job import RunQueryJob
from gcloud.bigquery.job import RunAsyncQueryJob


class Client(JSONClient):
Expand Down Expand Up @@ -155,16 +155,16 @@ def extract_table_to_storage(self, name, source, *destination_uris):
return ExtractTableToStorageJob(name, source, destination_uris,
client=self)

def run_query(self, name, query):
"""Construct a job for running a SQL query.
def run_async_query(self, name, query):
"""Construct a job for running a SQL query asynchronously.
:type name: string
:param name: Name of the job.
:type query: string
:param query: SQL query to be executed
:rtype: :class:`gcloud.bigquery.job.RunQueryJob`
:returns: a new ``RunQueryJob`` instance
:rtype: :class:`gcloud.bigquery.job.RunAsyncQueryJob`
:returns: a new ``RunAsyncQueryJob`` instance
"""
return RunQueryJob(name, query, client=self)
return RunAsyncQueryJob(name, query, client=self)
6 changes: 3 additions & 3 deletions gcloud/bigquery/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Encoding(_EnumProperty):


class QueryPriority(_EnumProperty):
"""Pseudo-enum for ``RunQueryJob.priority`` property."""
"""Pseudo-enum for ``RunAsyncQueryJob.priority`` property."""
INTERACTIVE = 'INTERACTIVE'
BATCH = 'BATCH'
ALLOWED = (INTERACTIVE, BATCH)
Expand Down Expand Up @@ -797,7 +797,7 @@ class _QueryConfiguration(object):
_write_disposition = None


class RunQueryJob(_BaseJob):
class RunAsyncQueryJob(_BaseJob):
"""Asynchronous job: query tables.
:type name: string
Expand All @@ -811,7 +811,7 @@ class RunQueryJob(_BaseJob):
for the dataset (which requires a project).
"""
def __init__(self, name, query, client):
super(RunQueryJob, self).__init__(name, client)
super(RunAsyncQueryJob, self).__init__(name, client)
self.query = query
self._configuration = _QueryConfiguration()

Expand Down
8 changes: 4 additions & 4 deletions gcloud/bigquery/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,16 @@ def test_extract_table_to_storage(self):
self.assertEqual(job.source, source)
self.assertEqual(list(job.destination_uris), [DESTINATION])

def test_run_query(self):
from gcloud.bigquery.job import RunQueryJob
def test_run_async_query(self):
from gcloud.bigquery.job import RunAsyncQueryJob
PROJECT = 'PROJECT'
JOB = 'job_name'
QUERY = 'select count(*) from persons'
creds = _Credentials()
http = object()
client = self._makeOne(project=PROJECT, credentials=creds, http=http)
job = client.run_query(JOB, QUERY)
self.assertTrue(isinstance(job, RunQueryJob))
job = client.run_async_query(JOB, QUERY)
self.assertTrue(isinstance(job, RunAsyncQueryJob))
self.assertTrue(job._client is client)
self.assertEqual(job.name, JOB)
self.assertEqual(job.query, QUERY)
Expand Down
6 changes: 3 additions & 3 deletions gcloud/bigquery/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,13 +1087,13 @@ def test_reload_w_alternate_client(self):
self._verifyResourceProperties(job, RESOURCE)


class TestRunQueryJob(unittest2.TestCase, _Base):
class TestRunAsyncQueryJob(unittest2.TestCase, _Base):
JOB_TYPE = 'query'
QUERY = 'select count(*) from persons'

def _getTargetClass(self):
from gcloud.bigquery.job import RunQueryJob
return RunQueryJob
from gcloud.bigquery.job import RunAsyncQueryJob
return RunAsyncQueryJob

def _verifyBooleanResourceProperties(self, job, config):

Expand Down

0 comments on commit d8d58ad

Please sign in to comment.