@@ -842,7 +842,8 @@ def upload_from_file(self,
842842 quote_character = None ,
843843 skip_leading_rows = None ,
844844 write_disposition = None ,
845- client = None ):
845+ client = None ,
846+ job_name = None ):
846847 """Upload the contents of this table from a file-like object.
847848
848849 The content type of the upload will either be
@@ -915,6 +916,10 @@ def upload_from_file(self,
915916 :param client: Optional. The client to use. If not passed, falls back
916917 to the ``client`` stored on the current dataset.
917918
919+ :type job_name: str
920+ :param job_name: Optional. The id of the job. Generated if not
921+ explicitly passed in.
922+
918923 :rtype: :class:`google.cloud.bigquery.jobs.LoadTableFromStorageJob`
919924 :returns: the job instance used to load the data (e.g., for
920925 querying status). Note that the job is already started:
@@ -977,7 +982,7 @@ def upload_from_file(self,
977982 encoding , field_delimiter ,
978983 ignore_unknown_values , max_bad_records ,
979984 quote_character , skip_leading_rows ,
980- write_disposition )
985+ write_disposition , job_name )
981986
982987 upload = Upload (file_obj , content_type , total_bytes ,
983988 auto_transfer = False )
@@ -1033,7 +1038,8 @@ def _configure_job_metadata(metadata, # pylint: disable=too-many-arguments
10331038 max_bad_records ,
10341039 quote_character ,
10351040 skip_leading_rows ,
1036- write_disposition ):
1041+ write_disposition ,
1042+ job_name ):
10371043 """Helper for :meth:`Table.upload_from_file`."""
10381044 load_config = metadata ['configuration' ]['load' ]
10391045
@@ -1067,6 +1073,9 @@ def _configure_job_metadata(metadata, # pylint: disable=too-many-arguments
10671073 if write_disposition is not None :
10681074 load_config ['writeDisposition' ] = write_disposition
10691075
1076+ if job_name is not None :
1077+ load_config ['jobReference' ] = {'jobId' : job_name }
1078+
10701079
10711080def _parse_schema_resource (info ):
10721081 """Parse a resource fragment into a schema field.
0 commit comments