@@ -164,16 +164,15 @@ class WriteDisposition(_EnumProperty):
164164class _AsyncJob (google .api .core .future .polling .PollingFuture ):
165165 """Base class for asynchronous jobs.
166166
167- :type name : str
168- :param name : the name of the job
167+ :type job_id : str
168+ :param job_id : the job's ID in the project associated with the client.
169169
170170 :type client: :class:`google.cloud.bigquery.client.Client`
171- :param client: A client which holds credentials and project configuration
172- for the dataset (which requires a project).
171+ :param client: A client which holds credentials and project configuration.
173172 """
174- def __init__ (self , name , client ):
173+ def __init__ (self , job_id , client ):
175174 super (_AsyncJob , self ).__init__ ()
176- self .name = name
175+ self .job_id = job_id
177176 self ._client = client
178177 self ._properties = {}
179178 self ._result_set = False
@@ -217,9 +216,9 @@ def path(self):
217216 """URL path for the job's APIs.
218217
219218 :rtype: str
220- :returns: the path based on project and job name .
219+ :returns: the path based on project and job ID .
221220 """
222- return '/projects/%s/jobs/%s' % (self .project , self .name )
221+ return '/projects/%s/jobs/%s' % (self .project , self .job_id )
223222
224223 @property
225224 def etag (self ):
@@ -367,21 +366,21 @@ def _get_resource_config(cls, resource):
367366
368367 :rtype: dict
369368 :returns: tuple (string, dict), where the first element is the
370- job name and the second contains job-specific configuration.
369+ job ID and the second contains job-specific configuration.
371370 :raises: :class:`KeyError` if the resource has no identifier, or
372371 is missing the appropriate configuration.
373372 """
374373 if ('jobReference' not in resource or
375374 'jobId' not in resource ['jobReference' ]):
376375 raise KeyError ('Resource lacks required identity information: '
377376 '["jobReference"]["jobId"]' )
378- name = resource ['jobReference' ]['jobId' ]
377+ job_id = resource ['jobReference' ]['jobId' ]
379378 if ('configuration' not in resource or
380379 cls ._JOB_TYPE not in resource ['configuration' ]):
381380 raise KeyError ('Resource lacks required configuration: '
382381 '["configuration"]["%s"]' % cls ._JOB_TYPE )
383382 config = resource ['configuration' ][cls ._JOB_TYPE ]
384- return name , config
383+ return job_id , config
385384
386385 def begin (self , client = None ):
387386 """API call: begin the job via a POST request
@@ -560,8 +559,9 @@ class _LoadConfiguration(object):
560559class LoadJob (_AsyncJob ):
561560 """Asynchronous job for loading data into a table from remote URI.
562561
563- :type name: str
564- :param name: the name of the job
562+ :type job_id: str
563+ :param job_id:
564+ The job's ID, belonging to the project associated with the client.
565565
566566 :type destination: :class:`google.cloud.bigquery.table.Table`
567567 :param destination: Table into which data is to be loaded.
@@ -766,7 +766,7 @@ def _build_resource(self):
766766 resource = {
767767 'jobReference' : {
768768 'projectId' : self .project ,
769- 'jobId' : self .name ,
769+ 'jobId' : self .job_id ,
770770 },
771771 'configuration' : {
772772 self ._JOB_TYPE : {
@@ -834,12 +834,12 @@ def from_api_repr(cls, resource, client):
834834 :rtype: :class:`google.cloud.bigquery.job.LoadJob`
835835 :returns: Job parsed from ``resource``.
836836 """
837- name , config = cls ._get_resource_config (resource )
837+ job_id , config = cls ._get_resource_config (resource )
838838 dest_config = config ['destinationTable' ]
839839 dataset = Dataset (dest_config ['datasetId' ], client )
840840 destination = Table (dest_config ['tableId' ], dataset )
841841 source_urls = config .get ('sourceUris' , ())
842- job = cls (name , destination , source_urls , client = client )
842+ job = cls (job_id , destination , source_urls , client = client )
843843 job ._set_properties (resource )
844844 return job
845845
@@ -856,8 +856,8 @@ class _CopyConfiguration(object):
856856class CopyJob (_AsyncJob ):
857857 """Asynchronous job: copy data into a table from other tables.
858858
859- :type name : str
860- :param name : the name of the job
859+ :type job_id : str
860+ :param job_id : the job's ID, within the project belonging to ``client``.
861861
862862 :type destination: :class:`google.cloud.bigquery.table.Table`
863863 :param destination: Table into which data is to be loaded.
@@ -872,8 +872,8 @@ class CopyJob(_AsyncJob):
872872
873873 _JOB_TYPE = 'copy'
874874
875- def __init__ (self , name , destination , sources , client ):
876- super (CopyJob , self ).__init__ (name , client )
875+ def __init__ (self , job_id , destination , sources , client ):
876+ super (CopyJob , self ).__init__ (job_id , client )
877877 self .destination = destination
878878 self .sources = sources
879879 self ._configuration = _CopyConfiguration ()
@@ -907,7 +907,7 @@ def _build_resource(self):
907907 resource = {
908908 'jobReference' : {
909909 'projectId' : self .project ,
910- 'jobId' : self .name ,
910+ 'jobId' : self .job_id ,
911911 },
912912 'configuration' : {
913913 self ._JOB_TYPE : {
@@ -949,7 +949,7 @@ def from_api_repr(cls, resource, client):
949949 :rtype: :class:`google.cloud.bigquery.job.CopyJob`
950950 :returns: Job parsed from ``resource``.
951951 """
952- name , config = cls ._get_resource_config (resource )
952+ job_id , config = cls ._get_resource_config (resource )
953953 dest_config = config ['destinationTable' ]
954954 dataset = Dataset (dest_config ['datasetId' ], client )
955955 destination = Table (dest_config ['tableId' ], dataset )
@@ -964,7 +964,7 @@ def from_api_repr(cls, resource, client):
964964 for source_config in source_configs :
965965 dataset = Dataset (source_config ['datasetId' ], client )
966966 sources .append (Table (source_config ['tableId' ], dataset ))
967- job = cls (name , destination , sources , client = client )
967+ job = cls (job_id , destination , sources , client = client )
968968 job ._set_properties (resource )
969969 return job
970970
@@ -983,8 +983,8 @@ class _ExtractConfiguration(object):
983983class ExtractJob (_AsyncJob ):
984984 """Asynchronous job: extract data from a table into Cloud Storage.
985985
986- :type name : str
987- :param name : the name of the job
986+ :type job_id : str
987+ :param job_id : the job's ID, within the project belonging to ``client``.
988988
989989 :type source: :class:`google.cloud.bigquery.table.Table`
990990 :param source: Table into which data is to be loaded.
@@ -1000,8 +1000,8 @@ class ExtractJob(_AsyncJob):
10001000 """
10011001 _JOB_TYPE = 'extract'
10021002
1003- def __init__ (self , name , source , destination_uris , client ):
1004- super (ExtractJob , self ).__init__ (name , client )
1003+ def __init__ (self , job_id , source , destination_uris , client ):
1004+ super (ExtractJob , self ).__init__ (job_id , client )
10051005 self .source = source
10061006 self .destination_uris = destination_uris
10071007 self ._configuration = _ExtractConfiguration ()
@@ -1065,7 +1065,7 @@ def _build_resource(self):
10651065 resource = {
10661066 'jobReference' : {
10671067 'projectId' : self .project ,
1068- 'jobId' : self .name ,
1068+ 'jobId' : self .job_id ,
10691069 },
10701070 'configuration' : {
10711071 self ._JOB_TYPE : {
@@ -1106,12 +1106,12 @@ def from_api_repr(cls, resource, client):
11061106 :rtype: :class:`google.cloud.bigquery.job.ExtractJob`
11071107 :returns: Job parsed from ``resource``.
11081108 """
1109- name , config = cls ._get_resource_config (resource )
1109+ job_id , config = cls ._get_resource_config (resource )
11101110 source_config = config ['sourceTable' ]
11111111 dataset = Dataset (source_config ['datasetId' ], client )
11121112 source = Table (source_config ['tableId' ], dataset )
11131113 destination_uris = config ['destinationUris' ]
1114- job = cls (name , source , destination_uris , client = client )
1114+ job = cls (job_id , source , destination_uris , client = client )
11151115 job ._set_properties (resource )
11161116 return job
11171117
@@ -1138,8 +1138,8 @@ class _AsyncQueryConfiguration(object):
11381138class QueryJob (_AsyncJob ):
11391139 """Asynchronous job: query tables.
11401140
1141- :type name : str
1142- :param name : the name of the job
1141+ :type job_id : str
1142+ :param job_id : the job's ID, within the project belonging to ``client``.
11431143
11441144 :type query: str
11451145 :param query: SQL query string
@@ -1163,9 +1163,9 @@ class QueryJob(_AsyncJob):
11631163 _UDF_KEY = 'userDefinedFunctionResources'
11641164 _QUERY_PARAMETERS_KEY = 'queryParameters'
11651165
1166- def __init__ (self , name , query , client ,
1166+ def __init__ (self , job_id , query , client ,
11671167 udf_resources = (), query_parameters = ()):
1168- super (QueryJob , self ).__init__ (name , client )
1168+ super (QueryJob , self ).__init__ (job_id , client )
11691169 self .query = query
11701170 self .udf_resources = udf_resources
11711171 self .query_parameters = query_parameters
@@ -1306,7 +1306,7 @@ def _build_resource(self):
13061306 resource = {
13071307 'jobReference' : {
13081308 'projectId' : self .project ,
1309- 'jobId' : self .name ,
1309+ 'jobId' : self .job_id ,
13101310 },
13111311 'configuration' : {
13121312 self ._JOB_TYPE : {
@@ -1399,9 +1399,9 @@ def from_api_repr(cls, resource, client):
13991399 :rtype: :class:`google.cloud.bigquery.job.RunAsyncQueryJob`
14001400 :returns: Job parsed from ``resource``.
14011401 """
1402- name , config = cls ._get_resource_config (resource )
1402+ job_id , config = cls ._get_resource_config (resource )
14031403 query = config ['query' ]
1404- job = cls (name , query , client = client )
1404+ job = cls (job_id , query , client = client )
14051405 job ._set_properties (resource )
14061406 return job
14071407
@@ -1573,7 +1573,7 @@ def query_results(self):
15731573 :returns: results instance
15741574 """
15751575 if not self ._query_results :
1576- self ._query_results = self ._client ._get_query_results (self .name )
1576+ self ._query_results = self ._client ._get_query_results (self .job_id )
15771577 return self ._query_results
15781578
15791579 def done (self ):
@@ -1585,7 +1585,7 @@ def done(self):
15851585 # Do not refresh is the state is already done, as the job will not
15861586 # change once complete.
15871587 if self .state != _DONE_STATE :
1588- self ._query_results = self ._client ._get_query_results (self .name )
1588+ self ._query_results = self ._client ._get_query_results (self .job_id )
15891589
15901590 # Only reload the job once we know the query is complete.
15911591 # This will ensure that fields such as the destination table are
0 commit comments