Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview

Namejobs
TypeResource
Idgoogle.bigquery.jobs

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringOutput only. Opaque ID field of the job.
configurationobjectRequired. Describes the job configuration. (id: JobConfiguration)
etagstringOutput only. A hash of this resource.
jobCreationReasonobjectOutput only. The reason why a Job was created. (id: JobCreationReason)
jobReferenceobjectOptional. Reference describing the unique-per-user name of the job. (id: JobReference)
kindstringOutput only. The type of the resource. (default: bigquery#job)
principal_subjectstringOutput only. [Full-projection-only] String representation of identity of requesting party. Populated for both first- and third-party identities. Only present for APIs that support third-party identities.
selfLinkstringOutput only. A URL that can be used to access the resource again.
statisticsobjectOutput only. Information about the job, including starting time and ending time of the job. (id: JobStatistics)
statusobjectOutput only. The status of this job. Examine this value when polling an asynchronous job to see if the job is complete. (id: JobStatus)
user_emailstringOutput only. Email address of the user who ran the job.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectId, +jobIdlocationReturns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
listselectprojectIdallUsers, maxCreationTime, maxResults, minCreationTime, pageToken, parentJobId, projection, stateFilterLists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
insertinsertprojectIdStarts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The Metadata URI is used for most interactions, as it accepts the job configuration directly. * The Upload URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.
deletedeleteprojectId, +jobIdlocationRequests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.
cancelexecprojectId, +jobIdlocationRequests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.
queryexecprojectIdRuns a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
+jobIdstring
projectIdstring
allUsersboolean
locationstring
maxCreationTimestring (uint64)
maxResultsinteger (uint32)
minCreationTimestring (uint64)
pageTokenstring
parentJobIdstring
projectionstring
stateFilterstring

SELECT examples

Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.

SELECT
id,
configuration,
etag,
jobCreationReason,
jobReference,
kind,
principal_subject,
selfLink,
statistics,
status,
user_email
FROM google.bigquery.jobs
WHERE projectId = '{{ projectId }}' -- required
AND +jobId = '{{ +jobId }}' -- required
AND location = '{{ location }}';

INSERT examples

Starts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The Metadata URI is used for most interactions, as it accepts the job configuration directly. * The Upload URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.

INSERT INTO google.bigquery.jobs (
data__configuration,
data__jobReference,
projectId
)
SELECT
'{{ configuration }}',
'{{ jobReference }}',
'{{ projectId }}'
RETURNING
id,
configuration,
etag,
jobCreationReason,
jobReference,
kind,
principal_subject,
selfLink,
statistics,
status,
user_email
;

DELETE examples

Requests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.

DELETE FROM google.bigquery.jobs
WHERE projectId = '{{ projectId }}' --required
AND +jobId = '{{ +jobId }}' --required
AND location = '{{ location }}';

Lifecycle Methods

Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.

EXEC google.bigquery.jobs.cancel 
@projectId='{{ projectId }}' --required,
@+jobId='{{ +jobId }}' --required,
@location='{{ location }}';